結果
| 問題 | No.816 Beautiful tuples | 
| コンテスト | |
| ユーザー |  takakin | 
| 提出日時 | 2020-05-11 18:05:17 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 385 bytes | 
| コンパイル時間 | 142 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-18 15:41:20 | 
| 合計ジャッジ時間 | 1,256 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 WA * 4 | 
ソースコード
import sys
input=lambda: sys.stdin.readline().rstrip()
a,b=map(int,input().split())
def make_divisors(n):
  divisors=[]
  for i in range(1,int(n**0.5)+1):
    if n%i==0:
      divisors.append(i)
      if i!=n//i:
        divisors.append(n//i)
  divisors.sort()
  return divisors
D=make_divisors(a+b)
for c in D:
  if (b+c)%a==0 and (c+a)%b==0:
    print(c)
    break
else:
  print(-1)
            
            
            
        