You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
662 B
26 lines
662 B
#include <iostream>
|
|
|
|
using namespace std;
|
|
int month_1[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
|
int month_2[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
|
|
|
bool LeapYear(int year) {
|
|
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) return true;
|
|
return false;
|
|
}
|
|
|
|
int main() {
|
|
int y, m, d, days = 0;
|
|
cin >> y >> m >> d;
|
|
if (LeapYear(y)) {
|
|
for (int i = 1; i <= m - 1; ++i)
|
|
days += month_2[i];
|
|
days += d;
|
|
} else {
|
|
for (int i = 1; i <= m - 1; ++i)
|
|
days += month_1[i];
|
|
days += d;
|
|
}
|
|
printf("%d", days);
|
|
return 0;
|
|
} |