1134:生日日数
Description
CCC老师的生日是YY年MM月DD日,他想知道自己出生后的第一万天纪念日的日期(出生日算第0天)。
Input
输入有多行,格式为YY MM DD 其中1949<=YY<=2006,日期绝对合法。
Ouput
输出有多行,即CCC老师生日第一万天以后的日期,格式为“Y-M-D”。
Sample Input
1979 4 16
Sample Output
2006-9-1
#include<iostream>
using namespace std;
int main()
{
int Y, M, D, day[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
while (cin >> Y >> M >> D)
{
for (int i = 1; i <= 10000; i++)
{
if (Y % 4 == 0)
day[2] = 29;
else
day[2] = 28;
D++;
if (D > day[M])
{
M++;
D = 1;
}
if (M == 13)
{
M= 1;
Y++;
}
}
cout << Y << "-" << M << "-" << D << endl;
}
}