CCC '07 S1 - Federal Voting Age

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2007 Stage 1, Senior #1

For the big election on February 27, 2007, the government has commissioned an electronic voting system, and you have been hired as a sub-subcontractor for this very grand programming project.

Your task is to write the system that determines whether a given person is old enough to vote. The voting age is 18, so given someone's birthday, you must determine whether that person will be 18 years of age on the day of the election.

Input Specification

The input will consist of a number n (1 \le n \le 100) on a single line, indicating the number of birthdays to evaluate. Then, each of the following n lines, will be of the form y m d, where y is the year of a potential voter's birth (0 \le y \le 2007), m (1 \le m \le 12) is the month of birth, and d (1 \le d \le 31) is the day. It is assured that each birthday is a correct and valid date.

Output Specification

For each date in the input, output a line with either Yes if the voter is eligible to vote, or No otherwise.

Sample Input

5
1933 10 29
1989 2 28
1961 11 23
1999 12 31
1989 2 27

Output for Sample Input

Yes
No
Yes
No
Yes

Comments


  • 0
    IAMW  commented on March 18, 2024, 6:38 p.m.

    Do we need to worry about leaf years?


    • 0
      chika  commented on March 18, 2024, 8:33 p.m.

      Leap year inputs are valid. This problem adheres to the real life standard around when someone born on February 29th is legally allowed to vote.


  • 3
    SkyTian  commented on Dec. 28, 2022, 4:12 p.m.

    [user:bariumlanthanum]

    bro. im born on the same day as you. same month. same year.


  • 5
    cchungelliot  commented on March 26, 2022, 9:23 p.m.

    What's with test case 4?


  • 26
    Dav_Did  commented on Jan. 20, 2021, 6:08 p.m. edit 2

    Just to give you guys some hints. 1989 2 27 would be the date that's 18 years before the election. (You guys gonna figure it out anyway, just saving some times y'all)


  • 16
    bariumlanthanum  commented on May 27, 2020, 7:29 p.m.

    I was exactly 0 years, 0 months and 0 days old during the election


    • 16
      spyral  commented on Feb. 28, 2021, 10:54 p.m.

      yesterday was your birthday, happy belated birthday


  • 11
    chessdongdong  commented on Feb. 2, 2020, 4:51 p.m.

    Took forever until realized that I did "yes" and "no" instead of "Yes" and "No" :(((.


    • 4
      Danny_rexran  commented on Jan. 25, 2021, 1:32 a.m.

      I almost made that mistake until I saw your comment. Thanks!


  • 4
    zys5945  commented on Sept. 17, 2015, 11:09 p.m.

    So the first letter in the two output options needs to be capitalized, u got me there


  • -9
    alpturkmen  commented on Feb. 6, 2015, 7:26 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 12
      Kirito  commented on March 14, 2016, 6:41 p.m.

      1) You misspelled Length (Who cares? I can't spell either) 2) It shouldn't matter. And for the record, the rule is every year that is divisible by 4, other than those that are divisible by 100, but those that are divisible by 400 are still leap years.

      E.g. 2000 is a leap year, 2100 is not, and 2004 is.