【C++】
#include<algorithm>
#include<string>
using namespace std;
int a[] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
bool isleapyear(int n) {
return(n % 400 == 0) || (n % 4 == 0 && n % 100 != 0);
}
int f(int year, int month, int day) {
if (isleapyear(year)) {
a[2] = 29;
}
int num = 0;
for (int i = 1; i < month; i++) {
num += a[i];
}
num += day;
return num;
}
int main() {
int year, month, day;
while (cin >> year >> month >> day) {
cout << f(year, month, day) << endl;
}
return 0;
}