結果

問題 No.816 Beautiful tuples
ユーザー stngstng
提出日時 2022-07-17 12:13:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 440 bytes
コンパイル時間 1,050 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 75,936 KB
最終ジャッジ日時 2023-09-12 00:04:13
合計ジャッジ時間 3,383 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 74 ms
71,624 KB
testcase_02 AC 76 ms
75,340 KB
testcase_03 WA -
testcase_04 AC 75 ms
75,632 KB
testcase_05 AC 77 ms
75,640 KB
testcase_06 AC 74 ms
75,580 KB
testcase_07 AC 76 ms
75,708 KB
testcase_08 AC 77 ms
75,312 KB
testcase_09 AC 76 ms
75,872 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 76 ms
75,568 KB
testcase_13 AC 77 ms
75,520 KB
testcase_14 AC 72 ms
71,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

a,b = map(int,input().split())
cli = make_divisors(a+b)
for i in range(len(cli)):
    c = cli[i]
    if (a+b) % c == 0 and (b+c) % a == 0 and (c+a) % b == 0:
        print(c)
        exit()

print(-1)
0