結果

問題 No.1593 Perfect Distance
ユーザー lloyzlloyz
提出日時 2021-12-06 23:56:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 15,900 KB
最終ジャッジ日時 2023-09-21 16:04:42
合計ジャッジ時間 1,948 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,068 KB
testcase_01 AC 17 ms
7,964 KB
testcase_02 AC 15 ms
7,872 KB
testcase_03 AC 14 ms
7,932 KB
testcase_04 AC 15 ms
7,888 KB
testcase_05 AC 14 ms
7,864 KB
testcase_06 AC 14 ms
7,888 KB
testcase_07 AC 15 ms
8,000 KB
testcase_08 AC 16 ms
7,968 KB
testcase_09 AC 23 ms
8,432 KB
testcase_10 AC 44 ms
9,296 KB
testcase_11 AC 62 ms
9,768 KB
testcase_12 AC 95 ms
11,228 KB
testcase_13 AC 103 ms
11,320 KB
testcase_14 AC 118 ms
11,952 KB
testcase_15 AC 166 ms
13,572 KB
testcase_16 AC 239 ms
15,900 KB
testcase_17 AC 15 ms
7,908 KB
testcase_18 AC 15 ms
7,936 KB
testcase_19 AC 15 ms
7,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right

n = int(input())
Sqr = [0 for _ in range(n + 1)]
for i in range(n + 1):
    Sqr[i] = i**2

ans = 0
for i in range(1, n):
    j = (n - i) * (n + i)
    ind = bisect_right(Sqr, j)
    if Sqr[ind - 1] == j:
        ans += 1
print(ans)
0