文章
60
粉丝
361
获赞
43
访问
524.7k
#include<iostream>
#include <string>
using namespace std;
int main()
{
int m,n;
int month[2][13]=
{{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,29,31,30,31,30,31,31,30,31,30,31}
};
while(scanf("%d %d",&m,&n)!=EOF)
{
int mon=1;
int day=1;
while(n-1>0)
{
//判断闰年
int flag=0;
if((m%400==0)||(m%4==0)&&(m%100!=0))
flag=1;
else
flag=0;
day++;
if(day>month[flag][mon])
{
day=1;
mon++;
}
n--;
}
printf("%d-%02d-%02d\n",m,mon,day);
}
system("pause");
return 0;
}
登录后发布评论
暂无评论,来抢沙发