C is difficult. A is also difficult
** Thoughts ** When I tried to enjoy it, I did WA, so I made a steady for.
k = int(input())
a, b = map(int,input().split())
for i in range(a,b+1):
if i % k == 0:
print('OK')
quit()
print('NG')
** Thoughts ** Just while
x = int(input())
seed = 100
ans = 0
while True:
seed = int(1.01 * seed)
ans += 1
if seed >= x:
print(ans)
break
** Thoughts ** I thought I'd do a full search, but the implementation seems to be heavy, so I gave up and went to D
** Thoughts ** If $ x <b $, the subtraction term at the end becomes 0 when the floor is taken, so $ x <b $. Intuitively, the larger the number, the larger it will be when you take the floor, so take the maximum $ x $ that meets the conditions.
import math
a, b, n = map(int,input().split())
n = min(b,n) #search range
if n == b:
n -= 1
ans = math.floor(a/b*n)
print(ans)
What is C? I will do my best tomorrow. see you. good night.
Recommended Posts