簡単 0件解決済み 正答率0%

Ticket Price by Age

Choose a cinema ticket price from the visitor's age.

問題

A cinema charges by age: children under 3 are free, ages 3–12 pay 5, ages 13–64 pay 12, and 65 or older pay 7.

Implement ticket_price(age).

Input

age: The visitor's age in years.

Output

Return the ticket price.

制約

0 ≤ age ≤ 120

例

例 1
入力:
age = 10

期待される出力:
expected = 5
入力:
long long age = 10;

期待される出力:
long long expected = 5;
入力:
long age = 10;

期待される出力:
long expected = 5;

解説

10 is between 3 and 12, so the price is 5.

例 2
入力:
age = 70

期待される出力:
expected = 7
入力:
long long age = 70;

期待される出力:
long long expected = 7;
入力:
long age = 70;

期待される出力:
long expected = 7;

解説

70 is 65 or older, so the senior price of 7 applies.

参考資料

この課題はCodeUtility用に調整されています。上記の説明と制約に従ってください。

他の人の解答から学ぶ

コミュニティの解答

まだ公開された解答がありません。この課題を解いて最初の解答を共有しましょう。