文章
55
粉丝
100
获赞
12
访问
31.1k
#include <stdio.h>
#include <iostream>
using namespace std;
int main(){
int arr[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int n;
cin >> n;
while(n--){
int year, month, day, count;
cin >> year >> month >> day >> count;
for(int i = 0; i<count; i++){
bool isLeap = year % 400 == 0 || (year % 100 != 0 && year % 4 == 0);
if(isLeap){
arr[2] = 29;
} else {
arr[2] = 28;
}
day++;
if(day > arr[month]){
month++;
day = 1;
}
if(month > 12){
year++;
month = 1;
}
}
printf("%d-%02d-%02d\n", year, month, day);
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发