結果

問題 No.982 Add
ユーザー 👑 H20H20
提出日時 2021-07-09 09:53:17
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 301 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 76,220 KB
最終ジャッジ日時 2023-09-14 06:22:49
合計ジャッジ時間 3,874 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,788 KB
testcase_01 AC 74 ms
71,432 KB
testcase_02 AC 75 ms
75,704 KB
testcase_03 AC 77 ms
75,764 KB
testcase_04 AC 72 ms
71,500 KB
testcase_05 AC 80 ms
75,880 KB
testcase_06 AC 78 ms
75,704 KB
testcase_07 AC 78 ms
75,908 KB
testcase_08 AC 75 ms
75,924 KB
testcase_09 AC 79 ms
76,220 KB
testcase_10 AC 80 ms
76,012 KB
testcase_11 AC 78 ms
75,884 KB
testcase_12 AC 78 ms
75,796 KB
testcase_13 AC 75 ms
75,732 KB
testcase_14 AC 78 ms
75,628 KB
testcase_15 AC 77 ms
75,900 KB
testcase_16 AC 82 ms
75,896 KB
testcase_17 AC 80 ms
75,904 KB
testcase_18 AC 75 ms
71,112 KB
testcase_19 AC 75 ms
71,204 KB
testcase_20 AC 75 ms
71,480 KB
testcase_21 AC 78 ms
71,228 KB
testcase_22 AC 76 ms
71,156 KB
testcase_23 AC 75 ms
71,088 KB
testcase_24 AC 81 ms
76,136 KB
testcase_25 AC 81 ms
75,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def my_lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B = map(int,input().split())
if math.gcd(A,B)>1:
    print(-1)
    exit()

ans = 0
lcm = my_lcm(A,B)
L=[0]*(lcm+1)
for j in range(101):
    for k in range(101):
        if A*j+B*k<=lcm:
            L[A*j+B*k]=1
print(len(L)-sum(L))
0