void addDay(){//assure it will not across the year if(d != 1){ D += d-1; d = 1; } while(D >= getMonthDay(m)){ D -= getMonthDay(m); m++; } d += D; }
int calculateRemainDate(){ int day = 0; int mm = m; day += getMonthDay(mm)-d; mm++; while(mm <= 12){ day += getMonthDay(mm); mm++; } return day+1; }
int main() { int year, month, day; scanf("%d-%d-%d", &year, &month, &day); //计算是第几天? 月份*month + day int result = day; int i; for (i = 1; i < month; i++) { // printf("%d\n", getMonthDay(year, i)); result += getMonthDay(year, i); } printf("%d\n", result); return 0; }