#include <stdio.h> struct date { int year; int month; int day; }; int main() { struct date test_day; scanf("%d %d %d", &test_day.year, &test_day.month, &test_day.day); int sum; sum = test_day.month * 30 + (test_day.month+1)/2; if (test_day.month == 10 || test_day.month == 12) { sum++; } if (test_day.year % 4 == 0) { sum--; } else { sum = sum - 2; } printf("%d", sum); } |
Double click to view unformatted code.