#include<iostream> using namespace std; //区分闰年,平年中2月的区别,以及月末时期,年末时期的进位 void caculate(int year,int month,int day) { day += 1; if(year % 400 == 0 ||(year % 4 == 0 && year % 100 != 0)) { if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { if(day > 31) { day = 1; month += 1; if(month > 12) { year += 1; month = 1; } } } else if(month == 2) { if(day > 29) { day = 1; month += 1; } } else { if(day > 30) { day = 1; month += 1; } } } else { if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { if(day > 31) { day = 1; month += 1; if(month > 12) { year += 1; month = 1; } } } else if(month == 2) { if(day > 28) { day = 1; month += 1; } } else { if(day > 30) { day = 1; month += 1; } } } cout << year << "-"; printf("%02d-%02d\n",month,day);//c的格式化输出右对齐宽度为2,不足用0补位 } int main(void) { int m; while(cin >> m) { while(m--) { int year,month,day; cin >> year >> month >> day; caculate(year, month, day); } } return 0; }