Limits 1s, 512 MB

One of Tommy’s family members is planning a trip to an amusement park, and Tommy is interested in calculating the cost of a ticket based on the park's pricing guidelines. The amusement park offers different ticket rates for visitors of various ages and weights.

Here are the established guidelines for pricing:

  • Children who are under 33 years of age and individuals aged 7070 or older are granted free tickets.

  • Children falling within the age range of 33 to 1212 years qualify for a child's ticket priced at $10.\$10.

  • Teenagers and adults, aged 1313 to 6464 can acquire a regular ticket for $20.\$20.

  • Anyone within the age range of 6565 to 6969 is eligible for a senior ticket, which costs $15.\$15.

  • If a visitor is between 3030 and 4040 years old and has a weight more then7575 kg, they are entitled to a discounted ticket priced at $18.\$18.

Now, let's develop a program that takes as input the age and weight of the visitor and calculates the admission ticket price according to the amusement park's rules.


The program expects the age in years AA and weight in kilograms WW of the visitor, both represented as integers on the first line.

  • 1A,W2001 ≤ A, W ≤ 200


If the admission ticket cost is $0\$0, the program will print "Free" in a single line. Otherwise, it will display the ticket price.


2 9
13 39

Be careful about the new line (‘\n’) at the end.


Login to submit.


94% Solution Ratio
SharifsoloEarliest, 5M ago
Tanvir_580Fastest, 0.0s
user.8526Lightest, 5.1 MB
user.6748Shortest, 279B
Toph uses cookies. By continuing you agree to our Cookie Policy.