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