1247:hh 10,000 Days time limit: 1 Sec Memory Limit: MB
Submit: Solved: 42
[Submit] [Status] [Web Board] [Edit] Description
HH's birthday is yy years mm month DD Day, he wants to know the date of the 10,000th Day anniversary of his birth (day of birth counted No. 0 day).
Input
Enter more than one line
First line first enter a number n
Next line 2nd to line n+1, each line entered a time, the format is YY MM DD where 1949<=yy<=2006, the date is absolutely legal.
Output
The output has multiple lines. That is, the date after the 10,000th day of the birthday of HH, formatted as "y-m-d".
One line of test data per set of output!
Sample Input1 1979 4Sample Output2006-9-1HINT
Test code is right and wrong, according to the background of multiple sets of test data to judge, not the problem of the test data can be AC
Source
The fifth annual ACM Program Design Competition of Henan University of Technology
must be very careful and careful to do just fine. Because of today's point, WA took two times.
#include <stdio.h> #include <string.h> bool F (int y) {return y% 4 = = 0 && y% = 0 | | y% 400 = = 0; } int cal (int y, int m, int d) {--m; Switch (m) {case 11:d + = 30; Case 10:d + = 31; Case 9:d + = 30; Case 8:d + = 31; Case 7:d + = 31; Case 6:d + = 30; Case 5:d + = 31; Case 4:d + = 30; Case 3:d + = 31; Case 2:d + = 28; if (f (y)) ++d; Case 1:d + = 31; } return D; } int main () {int y, M, D, T, SUM, TMP, I; scanf ("%d", &t); while (t--) {scanf ("%d%d%d", &y, &m, &d); TMP = 10000; TMP-= 365-cal (Y, M, d); if (f (y))--tmp; while (tmp > 365) {++y; TMP-= 365; if (f (y))--tmp; } ++y; for (i = 1; I <= && tmp > ++i) {if (i = = 1 | | i = = 3 | | i = = 5 | | i = = 7 | | i = = 8 | | i = = 10 | | i = =) tmp-= 31; else if (i = = 2) {tmp-= 28; if (f (y))--tmp; } else tmp-= 30; if (i = = 2 && tmp >) {if (f (Y) && tmp >) i = 3, tmp-= 29; else if (!f (y) && tmp >) i = 3, tmp-= 28; } else if (tmp = =) {if (!) ( i = = 1 | | i = = 3 | | i = = 5 | | i = = 7 | | i = = 8 | | i = = 10 | | i = =)) ++i, tmp = 1; } printf ("%d-%d-%d\n", Y, I, TMP); } return 0; }/************************************************************** problem:1247 User:changmu language:c++ result:accepted time:0 Ms memory:816 KB ****************************************************************/
HPU1247 HH 10,000-day "pit"