Last time Only one question today
#45 Problem
** Thoughts ** Since the solution range of mod2019 is 0 to 2018, it is not necessary to calculate more than 2018. Since 0 is the minimum value, the calculation will stop when it reaches 0.
l, r = map(int,input().split())
ans = 2019
flag = False
for i in range(l,r+1):
for j in range(i+1,r+1):
ans = min(ans,(i*j)%2019)
#print(i,j)
if ans == 0:
flag = True
break
if flag:
break
print(ans)
I received the Master of Integer, so I will proceed. see you
Recommended Posts