結果

問題 No.816 Beautiful tuples
ユーザー kekurekekure
提出日時 2019-07-07 23:57:11
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 289 bytes
コンパイル時間 1,184 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 59,028 KB
最終ジャッジ日時 2024-04-15 18:32:04
合計ジャッジ時間 6,117 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
59,028 KB
testcase_01 AC 39 ms
51,968 KB
testcase_02 AC 408 ms
57,600 KB
testcase_03 AC 1,192 ms
57,472 KB
testcase_04 AC 1,050 ms
57,344 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B = map(int, input().split())
divisor = [1]
ApB = A + B
for i in range(2, ApB):
    if ApB % i == 0 and i != A and i != B:
        divisor.append(i)

divisor.append(ApB)

for C in divisor:
    if (A + C) % B == 0 and (B + C) % A == 0:
        print(C)
        break
else:
    print(-1)
0