結果
| 問題 | No.816 Beautiful tuples |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-09 16:11:53 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 494 bytes |
| 記録 | |
| コンパイル時間 | 439 ms |
| コンパイル使用メモリ | 20,824 KB |
| 実行使用メモリ | 15,616 KB |
| 最終ジャッジ日時 | 2026-05-25 21:00:48 |
| 合計ジャッジ時間 | 3,176 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 4 |
ソースコード
from collections import defaultdict
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())
m = make_divisors(a+b)
for c in m:
if (a+b)%c == 0 and (b+c)%a == 0 and (c+a)%b == 0:
print(c)
exit()
print(-1)