文章
34
粉丝
89
获赞
2
访问
18.5k
#include<bits/stdc++.h> using namespace std; int mday[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; int main(){ int n; while(scanf("%d",&n) != EOF){ int d_sec = 3600 * 24; int days = n / d_sec; int num = 0; int b_month = 1;//一月份开始 int b_day = 1;//一号开始 for(int i = 1;i <= 12;){ if(num == days) break; num++; b_day++; if(b_day == mday[i] + 1){ b_day = 1; b_month++; i++; } } int sec = n % d_sec;//不超过一天的秒数 int hour = sec / 3600; int min = (sec % 3600) / 60; int last = (sec % 3600) % 60; printf("2009-%02d-%02d %02d:%02d:%02d\n",b_month,b_day,hour,min,last); } return 0; }
登录后发布评论
暂无评论,来抢沙发