Проблем с задача Convert Human years to Dog years

Здравейте, имам проблем с тази задача не ми минават 2 теста в judge. Output 21 , Output 35 , тоест при вход 3. Колко трябва да е outputa при този вход.

Most people believe that 1 human year (HYHY) equals 7 dog years (DYDY), however, dogs reach adulthood in approximately 2 human years.

So it’s better to count the first two HY as 10 DY each and then count the remaining HY as 4 DY each.

Write a program that correctly converts human years (HY) to dog years (DY). You may need some form of conditional logic.

Constraints:

1<=HY<=15

това ми е кода : https://pastebin.com/bBTZsrzh

Благодаря!

So it’s better to count the first two HY as 10 DY each and then count the remaining HY as 4 DY each. :slight_smile:

какво имаш предвид проверка if (HY>=1&&HY<=2) и DY = HY10
и в else DY = HY
4

Здравей,

So it’s better to count the first two HY as 10 DY each and then count the remaining HY as 4 DY each.

има се предвид, че ако са ти дадени някакви HY :

if (HY > 2) {
DY = 2x10 (count the first two HY as 10 DY each) + (HY-2)x4 (the remaining HY as 4 DY each)
} else {
DY = HYx10
}

1 Like

ок.мерси :slight_smile: