結果
問題 | No.816 Beautiful tuples |
ユーザー |
![]() |
提出日時 | 2020-05-11 18:06:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 29 ms / 1,500 ms |
コード長 | 403 bytes |
コンパイル時間 | 83 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-18 15:42:51 |
合計ジャッジ時間 | 1,022 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
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 and a!=c and b!=c: print(c) break else: print(-1)