文章
36
粉丝
0
获赞
5
访问
22.9k
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>
int main(void) {
int y,n;
int run[12]={31,29,31,30,31,30,31,31,30,31,30,31};
int normal[12]={31,28,31,30,31,30,31,31,30,31,30,31};
while(scanf("%d %d",&y,&n)!=EOF){
int i=0;
if((y%4==0&&y%100!=0)||y%400==0){
while(n>run[i]){
n = n-run[i];
i++;
}
if(i<=8&&n<10) printf("%d-0%d-0%d\n",y,i+1,n);
if(i>8&&n<10) printf("%d-%d-0%d\n",y,i+1,n);
if(i>8&&n>=10) printf("%d-%d-%d\n",y,i+1,n);
if(i<=8&&n>=10) printf("%d-0%d-%d\n",y,i+1,n);
}
else{
while(n>normal[i]){
n = n-normal[i];
i++;
}
if(i<=8&&n<10) printf("%d-0%d-0%d\n",y,i+1,n);
if(i>8&am...
登录后发布评论
暂无评论,来抢沙发