12345678910111213141516171819202122 |
- #include <stdio.h>
- int main() {
- int year, month, day;
- scanf("%d %d %d", &year, &month, &day);
-
- int result = day, i;
- for(i = 1; i < month; i++) {
- if (year % 4 == 0 && i == 2) result += 29;
- else {
- switch(i) {
- case 1: case 3: case 5: case 7: case 8: case 10: case 12: result += 31; break;
- case 2: result += 28; break;
- case 4: case 6: case 9: case 11: result += 30; break;
- }
- }
- }
-
- printf("%d", result);
-
- return 0;
- }
|