結果
| 問題 | No.816 Beautiful tuples | 
| コンテスト | |
| ユーザー |  titia | 
| 提出日時 | 2019-04-19 21:24:27 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 285 bytes | 
| コンパイル時間 | 93 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-09-22 16:11:55 | 
| 合計ジャッジ時間 | 1,231 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 WA * 4 | 
ソースコード
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)
            
            
            
        