3416. 时间显示

摘要
Title: 3416. 时间显示
Tag: 模拟
Memory Limit: 64 MB
Time Limit: 1000 ms

Powered by:NEFU AB-IN

Link

3416. 时间显示

  • 题意

    见原题

  • 思路

    关于python ff格式化字符串

    先去除后三位,模上(60 * 60 * 24), 代表一天,之后就照常求即可

  • 代码

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    '''
    Author: NEFU AB-IN
    Date: 2022-03-21 15:43:14
    FilePath: \ACM\Acwing\3416.py
    LastEditTime: 2022-03-21 15:43:15
    '''
    n = int(input()) // 1000

    n = n % 86400

    h = n // 3600
    n %= 3600
    m = n // 60
    s = n % 60

    print(f"{h:02}:{m:02}:{s:02}") # 指定两位的宽度
使用搜索:谷歌必应百度