Winne

Run Settings
LanguagePython
Language Version
Run Command
from decimal import Decimal, ROUND_HALF_UP cases = int(input()) for x in range(cases): H, U, D, F = input().split(' ') H, U, D, F = int(H), int(U), int(D), int(F) down = Decimal(U*F/100).quantize(Decimal('.0'), ROUND_HALF_UP) times, height = 1, U while True: height = height + U - D - (down*times) times += 1 if height >= H: break if height < 0: times = 0 break if times == 0: hour = 0 else: hour = Decimal(times) + Decimal((times-1)/2) print(hour)
Editor Settings
Theme
Key bindings
Full width
Lines