Programming contests

Magas szintű programozási nyelvek 1, gyakorló feladatsor, 2015. április 24.

April 24, 2015, 10:00 AM – April 24, 2015, 10:00 AM

How Old Are You?

...
– Here is the filled form.
– Thank you. Let me check... hum... OK, OK, OK... Wait, how old are you?
– 20. Did I forget to fill it?
– No. It says here that you'll be born next month! The year is wrong...
– Oh... Sorry!

The process is going to be automatic, and to avoid some human errors, there will be a calculated field that informs the age based on the current date and the birth date given. This is your task: calculate the age, or say if there's something wrong.

Input Specification

The first line of the input gives the number of test cases, T (1 ≤ T ≤ 200). T test cases follow. Each test case starts with a blank line, then you will have two lines corresponding to the current date and the birth date, respectively. The dates are in the format DD/MM/YYYY, where DD is the day, MM is the month, and YYYY is the year. All dates will be valid.

Output Specification

The output is comprised of one line for each input data set and should be as follows (quotes for clarifying only):

“Case #N: AGE“, where N is the number of the current test case, and AGE is one of the following three options:

  • “Invalid birth date”, if the calculated age is impossible (still going to be born).
  • “Check birth date”, if the calculated age is more than 130.
  • the calculated age (whole years only), otherwise.

Sample Input

  1. 4
  2. 01/01/2007
  3. 10/02/2007
  4. 09/06/2007
  5. 28/02/1871
  6. 12/11/2007
  7. 01/01/1984
  8. 28/02/2005
  9. 29/02/2004
download as text file

Output for Sample Input

  1. Case #1: Invalid birth date
  2. Case #2: Check birth date
  3. Case #3: 23
  4. Case #4: 0
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024