Hangzhou Electric 1201--18 year-old birthday

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.