結果
| 問題 |
No.816 Beautiful tuples
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-03-26 03:19:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 374 bytes |
| コンパイル時間 | 257 ms |
| コンパイル使用メモリ | 82,572 KB |
| 実行使用メモリ | 59,568 KB |
| 最終ジャッジ日時 | 2025-03-26 03:19:10 |
| 合計ジャッジ時間 | 2,094 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 4 |
ソースコード
def divisors(n: int) -> list[int]:
"""n の約数を求める"""
s = set()
p = 1
while p * p <= n:
if n % p == 0:
s.add(p)
s.add(n // p)
p += 1
return sorted(s)
A, B = map(int, input().split())
for c in divisors(A+B):
if (A+c) % B == 0 and (B+c) % A == 0:
print(c)
break
else:
print(-1)
norioc