結果

問題 No.816 Beautiful tuples
コンテスト
ユーザー kekure
提出日時 2019-07-07 23:57:11
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 289 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 253 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 57,476 KB
最終ジャッジ日時 2026-04-21 06:08:29
合計ジャッジ時間 4,160 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 TLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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