結果

問題 No.816 Beautiful tuples
ユーザー convexineqconvexineq
提出日時 2021-03-23 05:12:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 401 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 75,456 KB
最終ジャッジ日時 2023-08-16 08:29:52
合計ジャッジ時間 3,157 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 84 ms
71,132 KB
testcase_02 AC 81 ms
75,176 KB
testcase_03 WA -
testcase_04 AC 83 ms
75,428 KB
testcase_05 AC 83 ms
75,196 KB
testcase_06 AC 81 ms
75,176 KB
testcase_07 AC 83 ms
75,184 KB
testcase_08 AC 83 ms
75,388 KB
testcase_09 AC 83 ms
75,368 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 83 ms
75,456 KB
testcase_13 AC 84 ms
75,252 KB
testcase_14 AC 80 ms
71,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def divisor_list(N): #約数のリスト
    if N == 1: return [1]
    res = []
    for i in range(1,N):
        if i*i >= N: break
        if N%i == 0:
            res.append(i)
            res.append(N//i)
    if i*i == N: res.append(i)
    return sorted(res)

a,b = map(int,input().split())
div = divisor_list(a+b)
for d in div:
    if (d+a)%b==0==(d+b)%a:
        print(d)
        exit()
print(-1)
0