結果
問題 |
No.1198 お菓子配り-1
|
ユーザー |
|
提出日時 | 2022-01-30 15:33:14 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 62,464 KB |
最終ジャッジ日時 | 2024-06-11 08:18:16 |
合計ジャッジ時間 | 4,152 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)