TORONTO KIDS COMPUTER CLUB | Christmas Contest
16833
post-template-default,single,single-post,postid-16833,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Christmas Contest

13 Dec Christmas Contest

Question 1:

Santa Claus is playing card game with his reindeer to decide which route he’s going to take to send out the gifts. He is going to play six games. There are no ties. The gift route will be decided based on the results of games as follows:

  • if Santa wins 5 or 6 games, he’s going to take Route 1;
  • if Santa wins 3 or 4 games, he’s going to take Route 2;
  • if Santa wins 1 or 2 games, he’s going to take Route 3;
  • if Santa does not win any games, he will stay at home.

Write a program to determine which route Santa will going to take.

The input consists of six lines, each with one of two possible letters: W (to indicate a win) or L (to indicate a loss).


Sample Input 1:
W
L
W
W
L
W

Sample output 1:
Route 2


Sample Input 2:
L
L
L
L
L
L

Sample output 2:
Stay home



Question 2:
Santa Claus is wondering which extra gift(s) he’s going to send out for each kids. Eventually, he is going to use his reindeer to determine which gift(s) to give. There are only 3 types of gifts to give:
• Nerf Guns if the reindeer shook its tail at least 3 times and nodded its head at most 4 times;
• Spinners if the reindeer shook its tail at most 6 times and nodded its head at least 2 times;
• LEGOs if the reindeer shook its tail at most 2 times and nodded its head at most 3 times.

Input Specification
The user will be prompted to enter two numbers. First, the user will be prompted to enter the number of times the reindeer shook its tail. Second, the user will be prompted to enter the number of times the reindeer nodded its head.

Output Specification
The output will be the gifts given out match the signals given by the reindeer. If no gift match the signals, there is no output.

Sample 1 (with output shown in text, user input in italics)
How many times did reindeer shake its tail?
4
How many times did reindeer nod its head?
5
Spinners

Sample 2
How many times did reindeer shake its tail?
2
How many times did reindeer nod its head?
3
Spinners
LEGOs

Sample 3
How many times did reindeer shake its tail?
8
How many times did reindeer nod its head?
6



Question 3:
Santa commutes to post office each day to send out reply letters to the kids. If there is no rush-hour traffic, his commute time is 2 hours. However, there is often rush-hour traffic. Specifically, rush-hour traffic occurs from 07:00 (7am) until 10:00 (10am) in the morning and 15:00 (3pm) until 19:00 (7pm) in the afternoon. During rush-hour traffic, his speed is reduced by half.

Santa leaves either on the hour (at XX:00), 20 minutes past the hour (at XX:20), or 40 minutes past the hour (at XX:40).

Given Santa’s departure time, at what time does he arrive at post office?

Input Specification
The input will be one line, which contains an expression of the form HH:MM, where HH is one of the 24 starting hours (00, 01, : : :, 23) and MM is one of the three possible departure minute times (00, 20, 40).

Output Specification
Output the time of Fiona’s arrival, in the form HH:MM.

Sample Input 1
05:00

Output for Sample Input 1
07:00

Explanation for Output for Sample Input 1
Santa does not encounter any rush-hour traffic, and leaving at 5am, he arrives at exactly 7am.

Sample Input 2
07:00

Output for Sample Input 2
10:30

Explanation for Output for Sample Input 2
Santa drives for 3 hours in rush-hour traffic, but only travels as far as he normally would after driving for 1.5 hours. During the final 30 minutes (0.5 hours) she is driving in non-rush-hour traffic.

Sample Input 3
23:20

No Comments

Sorry, the comment form is closed at this time.