結果
| 問題 | No.816 Beautiful tuples |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-18 17:30:37 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 22 ms / 1,500 ms |
| + 622µs | |
| コード長 | 353 bytes |
| 記録 | |
| コンパイル時間 | 54 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2026-09-07 13:50:15 |
| 合計ジャッジ時間 | 1,563 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
def d(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
a, b = map(int, input().split())
div = d(a+b)
for c in div:
if a != c and b != c and (a+c) % b == 0 and (b+c) % a == 0:
print(c)
exit()
print(-1)