文章
40
粉丝
607
获赞
68
访问
421.0k
#include
#include
using namespace std;
int ping[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int run[13] = { 0,31,29,31,30,31,30,31,31,30,31,30,31 };
int main() {
int n;
while (cin >> n) {
while (n > 0) {
int year, month, day, count;
cin >> year >> month >> day >> count;
for (int i = 0; i < count; i++) {
day++;
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
if (day > run[month]) {
day = 1;
month++;
if (month > 12) {
year++;
month = 1;
}
}
}
else {
if (day > ping[month]) {
day = 1;
month++;
if (month > 12) {
year++;
month = 1;
}
}
}
}
//printf("%d-%02d-%02d\n", year, month, day);
cout << year <<"-"<< setfill('0') << setw(2) << month <<"-"<< setfill('0') << setw(2) << d...
登录后发布评论
暂无评论,来抢沙发