PAT B1026.程序运行时间

AC代码

#include <cstdio>
#define CLK_TCK 100

int main() {
    int C1, C2, C3;
    scanf("%d%d", &C1, &C2);
    //if(C1 < C2) return;
    C3 = C2 - C1;
    if(C3 < 0) return 0;
    if(C3 % CLK_TCK >= 50) {
        C3 = C3 / CLK_TCK + 1;
    } else {
        C3 = C3 / CLK_TCK;
    }
    printf("%02d:%02d:%02d\n", C3/3600, C3%3600/60, C3 % 60);
    return 0;
}

posted @ 2019-08-02 21:06  哨音  阅读(111)  评论(0编辑  收藏  举报