CCC '07 S1 - Federal Voting Age

View as PDF

Submit solution

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

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
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

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

Output for Sample Input



  • 0
    balathegreat999  commented on May 27, 2020, 3:29 p.m.

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

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

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

  • 0
    jaydenchu2003  commented on Dec. 11, 2019, 12:40 a.m. edited

    Anyone know why my Test Case #4 says IR in python?

    • -2
      edward_he  commented on Dec. 11, 2019, 12:27 p.m. edit 4

      why is my test case #4 IR in python 3? what is wrong with my code

      wtffff i tried like everything

    • 1
      Dingledooper  commented on Dec. 11, 2019, 1:16 a.m.

      You getting the month with int(bday[5]), which only takes a single character, but the month can be two digits (e.g. 12). A better way to take in input is list(map(int, input().split(' '))).

  • 1
    println_hi_  commented on Oct. 15, 2016, 2:37 p.m.

    I am slightly confused about how my(python) code gives me a IR error, especially as I have checked it and it works fine on my machine

    • 0
      Kirito  commented on Oct. 15, 2016, 4:49 p.m. edited

      Edit: The data is fixed now.

      • 4
        println_hi_  commented on Oct. 16, 2016, 3:03 a.m.

        Great, thank you:)

  • 3
    zys5945  commented on Sept. 17, 2015, 7:09 p.m.

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

  • -21
    Zhenpai  commented on Feb. 9, 2015, 11:21 a.m.

    This comment is hidden due to too much negative feedback. Click here to view it.

    • -10
      Ninjacat  commented on May 27, 2015, 6:18 p.m.

      This comment is hidden due to too much negative feedback. Click here to view it.

  • -3
    alpturkmen  commented on Feb. 6, 2015, 2:26 p.m.

    can we assume all years are 365 days long?

    • 6
      Kirito  commented on March 14, 2016, 2: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.