結果

問題 No.816 Beautiful tuples
ユーザー convexineqconvexineq
提出日時 2021-03-23 05:13:16
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 416 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 86,672 KB
実行使用メモリ 79,972 KB
最終ジャッジ日時 2023-08-16 08:30:52
合計ジャッジ時間 3,317 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 69 ms
71,352 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 71 ms
75,316 KB
testcase_08 AC 71 ms
75,160 KB
testcase_09 AC 70 ms
75,368 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 72 ms
75,496 KB
testcase_13 AC 74 ms
75,236 KB
testcase_14 AC 70 ms
71,176 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 and a!=b!=c!=a:
        print(d)
        exit()
print(-1)
0