1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

はじめに

前回
今日は一問だけ

#45

問題

考えたこと
mod2019の解の範囲は0~2018なので、2018通り以上計算する必要はありません。0が最小の値なので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)

まとめ

マスターオブ整数が届いたので進めます。では、また

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?