結果
| 問題 | No.816 Beautiful tuples | 
| コンテスト | |
| ユーザー |  _KingdomOfMoray | 
| 提出日時 | 2020-01-10 18:39:05 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 618 bytes | 
| コンパイル時間 | 238 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-11-23 22:14:19 | 
| 合計ジャッジ時間 | 1,337 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 WA * 4 | 
ソースコード
def divisor_list_calc(n):
    res_list = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            res_list.append(i)
            if n // i != i:
                res_list.append(n)
    return res_list
            
a, b = map(int,input().split())
res = -1
c_list = divisor_list_calc(a + b)
for i in range(len(c_list)):
    cond_list = []
    
    cond_list.append((b + c_list[i]) % a == 0)
    cond_list.append((a + c_list[i]) % b == 0)
    cond_list.append(a != c_list[i])
    cond_list.append(b != c_list[i])
    
    if all(cond_list):
        res = c_list[i]
        break
        
print(res)
            
            
            
        