結果
| 問題 | No.816 Beautiful tuples | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-06-24 20:00:02 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 331 bytes | 
| コンパイル時間 | 242 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 11,008 KB | 
| 最終ジャッジ日時 | 2024-07-02 15:02:31 | 
| 合計ジャッジ時間 | 1,403 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 WA * 4 | 
ソースコード
a, b = map(int, input().split())
tmp = a + b
lst = []
for i in range(2, int(tmp ** 0.5) + 1):
    if tmp % i == 0:
        lst.append(i)
        lst.append(tmp // i)
        
for num in lst:
    if a == num or b == num:
        continue
    if (a + num) % b == 0 and (b + num) % a == 0:
        print(num)
        exit()
print(-1)
            
            
            
        