Practice · 6 of 6
Mowing the Field
CHALLENGE
Difficulty: intermediate+25 XP
**Description:** A lawn is 1 cm tall. Each day it grows by g cm; each
evening a mower cuts it back to h cm (only if it is taller than h).
After how many full days is the lawn taller than T cm for the first time?
Print the day number, or -1 if it never happens within 10^6 days.
**Input:** One line: g h T (0 ≤ g ≤ 10, 0 ≤ h ≤ 10, 1 ≤ T ≤ 10^9).
**Output:** One integer — the first day the height exceeds T, else -1.
**Example:** 2 1 4 → day1: 1+2=3 (cut to 1), day2: 1+2=3… never exceeds
4 → -1. With 3 1 4: day1: 4 (not > 4? cut), day2: 4… -1. With
4 1 4: day1: 1+4=5 > 4 → 1.
Press Submit to check your solution.
Back to lesson: Practice: Loop Patterns Set