結果

問題 No.982 Add
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-10 03:17:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 76,340 KB
最終ジャッジ日時 2023-08-10 00:26:02
合計ジャッジ時間 4,050 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,440 KB
testcase_01 AC 73 ms
71,584 KB
testcase_02 AC 71 ms
71,324 KB
testcase_03 AC 78 ms
71,280 KB
testcase_04 AC 72 ms
71,228 KB
testcase_05 AC 84 ms
75,900 KB
testcase_06 AC 74 ms
75,800 KB
testcase_07 AC 75 ms
76,052 KB
testcase_08 AC 72 ms
71,232 KB
testcase_09 AC 79 ms
76,340 KB
testcase_10 AC 80 ms
76,056 KB
testcase_11 AC 71 ms
71,328 KB
testcase_12 AC 70 ms
71,352 KB
testcase_13 AC 72 ms
71,452 KB
testcase_14 AC 73 ms
71,328 KB
testcase_15 AC 74 ms
71,300 KB
testcase_16 AC 78 ms
75,984 KB
testcase_17 AC 76 ms
76,136 KB
testcase_18 AC 74 ms
71,452 KB
testcase_19 AC 73 ms
71,516 KB
testcase_20 AC 74 ms
71,452 KB
testcase_21 AC 75 ms
71,724 KB
testcase_22 AC 75 ms
71,608 KB
testcase_23 AC 76 ms
71,532 KB
testcase_24 AC 78 ms
75,896 KB
testcase_25 AC 80 ms
76,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, input().split())
L = []

import math
g = math.gcd(a, b)
if g != 1:
    print(-1)
    exit()

l = (a*b)//g

for x in range(b+1):
    for y in range(a+1):
        z = a*x+b*y
        if z <= l:
            L.append(z)

L = set(L)
print(l-len(L)+1)
0