結果

問題 No.816 Beautiful tuples
ユーザー titiatitia
提出日時 2019-04-19 21:24:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 285 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 10,208 KB
最終ジャッジ日時 2023-10-23 22:58:14
合計ジャッジ時間 1,808 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 27 ms
10,208 KB
testcase_02 AC 27 ms
10,208 KB
testcase_03 WA -
testcase_04 AC 28 ms
10,208 KB
testcase_05 AC 34 ms
10,208 KB
testcase_06 AC 28 ms
10,208 KB
testcase_07 AC 28 ms
10,208 KB
testcase_08 AC 28 ms
10,208 KB
testcase_09 AC 27 ms
10,208 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 32 ms
10,208 KB
testcase_13 AC 31 ms
10,208 KB
testcase_14 AC 27 ms
10,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B=map(int,input().split())
x=A+B
import math
xr=math.ceil(math.sqrt(x))

LIST=[]
for i in range(1,xr+1):
    if x%i==0:
        LIST.append(i)
        LIST.append(x//i)

LIST.sort()

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