結果

問題 No.982 Add
ユーザー stngstng
提出日時 2022-08-15 20:21:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 61,520 KB
最終ジャッジ日時 2024-04-10 07:00:34
合計ジャッジ時間 2,540 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,760 KB
testcase_01 AC 36 ms
53,324 KB
testcase_02 AC 37 ms
53,264 KB
testcase_03 AC 37 ms
52,800 KB
testcase_04 AC 36 ms
52,592 KB
testcase_05 AC 42 ms
61,520 KB
testcase_06 AC 39 ms
59,636 KB
testcase_07 AC 42 ms
60,448 KB
testcase_08 AC 38 ms
53,264 KB
testcase_09 AC 43 ms
60,912 KB
testcase_10 AC 43 ms
60,552 KB
testcase_11 AC 37 ms
53,684 KB
testcase_12 AC 36 ms
52,440 KB
testcase_13 AC 37 ms
52,556 KB
testcase_14 AC 36 ms
52,620 KB
testcase_15 AC 37 ms
52,464 KB
testcase_16 AC 42 ms
61,456 KB
testcase_17 AC 40 ms
58,716 KB
testcase_18 AC 35 ms
52,696 KB
testcase_19 AC 35 ms
52,852 KB
testcase_20 AC 35 ms
52,816 KB
testcase_21 AC 36 ms
52,576 KB
testcase_22 AC 35 ms
52,960 KB
testcase_23 AC 35 ms
54,280 KB
testcase_24 AC 42 ms
61,008 KB
testcase_25 AC 43 ms
60,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
a,b = map(int,input().split())
gd = math.gcd(a,b)
if gd != 1:
    print(-1)
    exit()

li = [0]*(a*b+1)
for i in range(a+1):
    for j in range(b+1):
        tmp = b*i+a*j
        if tmp <= a*b:
            li[tmp] = 1
        
#print(li)
ans = 0
for i in range(a*b+1):
    if li[i] == 0:
        ans += 1
print(ans)
0