。
分析:
原来一天天数是这样简单。。
#includeint month[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};int is_leap(int n){ return ((n % 4 == 0 && n % 100 != 0) || (n % 400 == 0));}void pre(int n){ int y = 2013, m = 3, d = 24; while(n--){ d--; if(d == 0){ m--; if(m < 1){ m=12; y--; } month[2] = 28+is_leap(y); d = month[m]; } } printf("%04d/%02d/%02d\n", y, m, d);}void next(int n){ int y = 2013, m = 3, d = 24; while(n--){ d++; month[2] = 28+is_leap(y); if(d > month[m]){ d = 1; m++; if(m>12){ m = 1; y++; } } } printf("%04d/%02d/%02d ", y, m, d);}int main(){ int T, n; scanf("%d", &T); while(T--){ scanf("%d", &n); next(n); pre(n); } return 0;}