#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
bool isLeapYear(int yy)
{
if(yy%400 == 0) return true;
if(yy%4 == 0 && yy%100) return true;
return false;
}
int main()
{
int yy, mm, dd;
int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
while(scanf("%d %d %d", &yy, &mm, &dd) != EOF)
{
int m = 1, d = 1, flag = isLeapYear(yy), cnt = 1;
while(m != mm || d != dd)
{
d++;
cnt++;
if(m == 2 && d == month[m]+1+flag
|| m != 2 && d == month[m]+1)
{
d = 1;
m++;
}
}
printf("%d\n", cnt);
}
return 0;
}
【清华大学考研机试题】今年的第几天?
最新推荐文章于 2024-06-08 19:12:46 发布