蓝桥杯时间显示
题目链接:https://www.lanqiao.cn/problems/1452/learning/;
看题目数据10^18是很吓人的,我以为得用高精度..........;
不!实则不然!long long 就可以过
然后这个题就变成模拟了:
#include<bits/stdc++.h> using namespace std; int main() { long long day = 24*60*60*1000; long long time; ios::sync_with_stdio(false); cin >> time; time = time%day; int t1 = time/(60*60*1000); time = time%(60*60*1000); int t2 = time/(60*1000); time = time%(60*1000); int t3 = time/(1000); printf("%02d:%02d:%02d\n",t1,t2,t3); return 0; }
本文来自博客园,作者:江上舟摇,转载请注明原文链接:https://www.cnblogs.com/LQS-blog/p/16072915.html