結果
問題 | No.1198 お菓子配り-1 |
ユーザー | irumo8202 |
提出日時 | 2022-01-30 15:33:14 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 557 bytes |
コンパイル時間 | 387 ms |
コンパイル使用メモリ | 87,352 KB |
実行使用メモリ | 80,164 KB |
最終ジャッジ日時 | 2023-09-02 01:39:39 |
合計ジャッジ時間 | 4,887 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,668 KB |
testcase_01 | AC | 66 ms
71,624 KB |
testcase_02 | AC | 67 ms
71,496 KB |
testcase_03 | AC | 67 ms
71,352 KB |
testcase_04 | AC | 69 ms
75,648 KB |
testcase_05 | AC | 70 ms
71,612 KB |
testcase_06 | AC | 69 ms
75,644 KB |
testcase_07 | AC | 68 ms
75,508 KB |
testcase_08 | AC | 70 ms
75,436 KB |
testcase_09 | AC | 70 ms
75,604 KB |
testcase_10 | AC | 70 ms
75,596 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)