2021年蓝桥杯省赛第一场F题
题目链接:http://acm.mangata.ltd/p/P1488
考点暴力、小技巧
视频讲解视频连接:https://www.bilibili.com/video/BV1z44y1s7wD/
思路因为给出的是一个毫秒值,那么我们要将其转化为秒、分钟、小时,注意的是1s=1000ms,其余的进制都是60,别记错了!,关于补0显示:%02d这样的话如果不满两位数,会自动补上的
代码#includeusing namespace std; //----------------自定义部分---------------- #define ll long long #define mod 1000000009 #define endl "n" #define PII pair int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0}; ll ksm(ll a,ll b) { ll ans = 1; for(;b;b>>=1LL) { if(b & 1) ans = ans * a % mod; a = a * a % mod; } return ans; } ll lowbit(ll x){return -x & x;} const int N = 2e6+10; //----------------自定义部分---------------- int n,m,q,a[N]; int main() { // std::ios::sync_with_stdio(false); // std::cin.tie(nullptr); // std::cout.tie(nullptr); ll tm; scanf("%lld",&tm); tm /= 1000; ll s = tm; s %= 60; tm /= 60; ll m = tm; m %= 60; tm /= 60; ll h = tm; h %= 24; printf("%02lld:%02lld:%02lldn",h,m,s); return 0; }



