题目描述:
源码:
#include <cstdio> #include <ctime> int main() { int year, month, day; int sum; while(scanf("%d/%d/%d", &year, &month, &day) != EOF) { sum = day; for(int i = 1; i < month; i++) { if(i == 1 || i == 3 || i == 5 || i == 7 || i == 9 || i == 10 || i == 12) { sum += 31; } else if(i == 2) { if(year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { sum += 29; } else { sum += 28; } } else { sum += 30; } } printf("%d ", sum); } return 0; }