CCC '12 J1 - Speed fines are not fine!

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2012 Stage 1, Junior #1

Many communities now have "radar" signs that tell drivers what their speed is, in the hope that they will slow down.

You will output a message for a "radar" sign. The message will display information to a driver based on his/her speed according to the following table:

km/h over the limit Fine
1 to 20 $100
21 to 30 $270
31 or above $500

Input Specification

The user will be prompted to enter two integers. First, the user will be prompted to enter the speed limit. Second, the user will be prompted to enter the recorded speed of the car.

Note: Due to the official test data being weak, additional test data worth 1 mark has been uploaded. Credit goes to d for noticing the issue and adding data.

Output Specification

If the driver is not speeding, the output should be: Congratulations, you are within the speed limit!

If the driver is speeding, the output should be: You are speeding and your fine is $F. where F is the amount of the fine as described in the table above.

Sample Input 1

40
39

Sample Output 1

Congratulations, you are within the speed limit!

Sample Input 2

100
131

Sample Output 2

You are speeding and your fine is $500.

Sample Input 3

100
120

Sample Output 3

You are speeding and your fine is $100.

Comments


  • 2
    maxcruickshanks  commented on Nov. 17, 2024, 11:04 p.m.

    Since the original data were weak, an additional batch of test data was added worth 1 mark, and all submissions were rejudged.