其他分享
首页 > 其他分享> > 蓝桥杯时间显示

蓝桥杯时间显示

作者:互联网

题目链接: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;
}

  

标签:60,显示,02d,int,long,蓝桥,时间,time,1000
来源: https://www.cnblogs.com/LQS-blog/p/16072915.html