Problem list
Log in
#r03560 · CCC 2020 Junior

Dog Treats

Bronze IV 2.0 s 256 MB

Barley the dog loves treats. At the end of the day he is either happy or sad depending on the number and size of treats he receives throughout the day. The treats come in three sizes: small, medium, and large. His happiness score can be measured using the following formula:

$$1 \times S + 2 \times M + 3 \times L$$

where $S$ is the number of small treats, $M$ is the number of medium treats and $L$ is the number of large treats.

If Barley’s happiness score is $10$ or greater then he is happy. Otherwise, he is sad. Determine whether Barley is happy or sad at the end of the day.

Input

There are three lines of input. Each line contains a non-negative integer less than $10$. The first line contains the number of small treats, $S$, the second line contains the number of medium treats, $M$, and the third line contains the number of large treats, $L$, that Barley receives in a day.

Output

If Barley’s happiness score is $10$ or greater, output happy. Otherwise, output sad.

Example 1

Input
3
1
0
Output
sad

Barley’s happiness score is $1 \times 3 + 2 \times 1 + 3 \times 0 = 5$, so he will be sad.

Example 2

Input
3
2
1
Output
happy

Barley’s happiness score is $1 \times 3 + 2 \times 2 + 3 \times 1 = 10$, so he will be happy.

Source
CCC 2020 Junior
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code