文章
105
粉丝
69
获赞
117
访问
56.9k
#include<bits/stdc++.h>
using namespace std;
int month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int n;
int y, m, d;
bool cheak(int y)
{
return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
}
int main()
{
cin >> n;
while(n --)
{
cin >> y >> m >> d;
month[2] += cheak(y);
if(d + 1 > month[m])
{
d = 1;
m += 1;
if(m > 12) m = 1, y += 1;
}
else d += 1;
printf("%04d-%02d-%02d\n", y, m, d);
month[2] = 28;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发