18-year-old birthday
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 23275 Accepted Submission (s): 7449
Problem Descriptiongardon's 18 birthday is coming, he is certainly very happy, but he suddenly thought of a question, is everyone from birth, to reach the 18 birthday when the number of days are the same? It doesn't seem to be all that, so he wants to ask you to calculate the total number of days he and his friends have passed since they were born to their 18 birthday.
Input is a number T, and the following T line has a date on each line, and the format is YYYY-MM-DD. As my birthday is in 1988-03-07.
Outputt lines, one number per line, indicating the number of days that the person has passed from birth to the age of 18. If this person does not have a 18 birthday, then output-1.
Sample INPUT1 1988-03-07
Sample Output6574
Authorgardon
Sourcegardon-dygg Contest 2
recommendjgshining | We have carefully selected several similar problems for you:1205 1215 1228 1235 1202//Never thought AC:
1#include <stdio.h>2 intnum[ -] = {0, to, -, to, -, to, -, to, to, -, to, -, to};3 intJudgeintYear )4 {5 if(Year%4==0&& Year% -!=0) || Year% -==0)6 return 1 ; 7 Else8 return 0 ;9 }Ten intMain () One { A intI, J, N, y, M, D; - -scanf"%d", &n); the while(n--) - { -scanf"%d-%d-%d", &y, &m, &d); - if(M = =2&& judge (y) && d = = in&&!judge (y+ -))//No 18-year-old birthday; + { -printf"-1\n") ; + Continue ; A } at intsum =0 ; - for(i = y; i < y+ -; i++) - { -Sum + =365 ; - if(judge (i)) -Sum + =1 ; in } - intTotal =D; to for(i =1; I < m; i++) +Total + =Num[i]; - intGQ = d, NW =D; the if(Judge (y) && m >2) *GQ + =1 ; $ if(Judge (y+ -) && m >2)Panax NotoginsengNW + =1 ; - intRe = Sum-gq +NW; theprintf"%d\n", re); + } A return 0 ; the}
Can AC:
Hangzhou Electric 1201--18 year-old birthday