文章
11
粉丝
69
获赞
1
访问
7.0k
#include<stdio.h>
#include<stdbool.h>
bool isL(int year)//判断闰年
{
if((year%4==0&&year%100!=0)||year%400==0)
return true;
else return false;
}
int main()
{
int year,days;
while(scanf("%d %d",&year,&days)!=EOF)
{
int c=1;//记录月份
int m[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
if(isL(year)) m[2]=29;
while(days>m[c])
{
days-=m[c++];
}
printf("%d-%02d-%02d\n",year,c,days);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发