結果
| 問題 | No.1198 お菓子配り-1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-30 15:33:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 557 bytes |
| 記録 | |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 64,816 KB |
| 最終ジャッジ日時 | 2024-06-11 08:18:11 |
| 合計ジャッジ時間 | 4,283 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 TLE * 1 -- * 6 |
ソースコード
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]
N = int(input())
divisors = make_divisors(N)
flg = False
for d in divisors:
a = (N // d + d) / 2
b = (N // d - d) / 2
if not (a == int(a) and b == int(b)):
continue
if a ** 2 - b ** 2 == N:
flg = True
print(1 if flg else -1)