#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
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}
};
bool isLeapYear(int x) {return (x%400==0) || (x%4==0 && x%100!=0);}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int yy, mm, dd;
cin >> yy >> mm >> dd;
int cnt = 0;
for (int i=0; i<mm; ++i) {
cnt += month[isLeapYear(yy)][i];
}
cnt += dd;
cout << cnt << endl;
return 0;
}
XJT软件考研真题:判断xx年xx月xx日是当年的第几天
最新推荐文章于 2020-12-24 20:46:48 发布