文章
40
粉丝
607
获赞
68
访问
419.5k
#include<iostream>
#include<iomanip>
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 };
void time(int year, int month, int day, int count) {
while (count > 0) {
count--;
if (month == 12 && day == 31) {
year++;
month = 1;
day = 1;
continue;
}
else if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) {
if (day == run[month]) {
month++;
day = 1;
continue;
}
else {
day++;
continue;
}
}
else {
if (day == ping[month]) {
month++;
day = 1;
continue;
}
else {
day++;
continue;
}
}
}
cout << year << "-" << setfill('0') << setw(2) << month << "-" << setfill('0') << setw(2) << day << " ";
}
int main() {
int count;
while (cin >> count) {
int hour, min, sec;
se...
登录后发布评论
暂无评论,来抢沙发