結果
| 問題 | No.816 Beautiful tuples |
| コンテスト | |
| ユーザー |
H20
|
| 提出日時 | 2021-01-28 16:09:55 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 28 ms / 1,500 ms |
| + 618µs | |
| コード長 | 463 bytes |
| 記録 | |
| コンパイル時間 | 71 ms |
| コンパイル使用メモリ | 80,640 KB |
| 実行使用メモリ | 59,776 KB |
| 最終ジャッジ日時 | 2026-10-12 20:25:19 |
| 合計ジャッジ時間 | 1,745 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
A,B = map(int,input().split())
CD = make_divisors(A+B)
for C in CD:
if not A==C and not B==C and (A+C)%B==0 and (B+C)%A==0:
print(C)
exit()
print(-1)
H20