2007 Canadian Computing Competition, Stage 1

Problem S1: Federal Voting Age

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

The input will consist of a number n (1 ≤ n ≤ 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 ≤ y ≤ 2007), m (1 ≤ m ≤ 12) is the month of birth, and d (1 ≤ d ≤ 31) is the day. It is assured that each birthday is a correct and valid date.

Output

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

Sample Output

Yes
No
Yes
No
Yes

All Submissions
Best Solutions


Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 30, 2008

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

Why am I getting 20/30 when I submit my code? I've tried to debug it but I do not see any problems.

What is wrong with my code. It is giving me 10/30. What did I do wrong.

18 as of what date? this program is from 2007 but it is 2014 so
answers may be different.

February 27, 2007

do not understand

Well, your if statement that checks the year/month/day is simply wrong.