結果
問題 | No.1198 お菓子配り-1 |
ユーザー | irumo8202 |
提出日時 | 2022-01-30 15:33:14 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 355 ms |
コンパイル使用メモリ | 87,280 KB |
実行使用メモリ | 80,524 KB |
最終ジャッジ日時 | 2023-09-02 01:39:34 |
合計ジャッジ時間 | 5,705 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 67 ms
71,600 KB |
testcase_01 | AC | 67 ms
71,424 KB |
testcase_02 | AC | 68 ms
71,400 KB |
testcase_03 | AC | 69 ms
71,268 KB |
testcase_04 | AC | 69 ms
75,400 KB |
testcase_05 | AC | 68 ms
71,500 KB |
testcase_06 | AC | 70 ms
75,608 KB |
testcase_07 | AC | 70 ms
75,532 KB |
testcase_08 | AC | 71 ms
75,560 KB |
testcase_09 | AC | 68 ms
75,536 KB |
testcase_10 | AC | 70 ms
75,540 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
ソースコード
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)