文章

70

粉丝

0

获赞

272

访问

46.3k

头像
Aconly时间戳 题解:
P1545 杭州电子科技大学机试题
发布于 2026年3月
阅读数 670

#include<stdio.h>
#include<iostream>

using namespace std;

int md[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};

void acum(int n){
    int m=1,d=1,h=0,mins=0,s=0;

    while(n--){
        s++;
        if( s > 59){
            s = 0;
            mins++;
            if( mins > 59 ){
                mins = 0;
                h++;
                if( h > 23 ){
                    h = 0;
                    d++;
                    if( d > md[m]){
                        d = 1;
                        m++;
                    }
                }
            }
        }
    }
    printf("2009-%02d-%02d %02d:%02d:%02d\n",m,d,h,mins,s);
}

int main(){
    int n;
    while(cin>>n){
        acum(n);
    }
}
 



登录后发布评论

暂无评论,来抢沙发