結果

問題 No.1593 Perfect Distance
ユーザー lemonlemon
提出日時 2021-07-09 23:06:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 464 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 25,480 KB
最終ジャッジ日時 2023-09-14 10:38:54
合計ジャッジ時間 1,793 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,824 KB
testcase_01 AC 17 ms
7,852 KB
testcase_02 AC 17 ms
7,804 KB
testcase_03 AC 16 ms
7,932 KB
testcase_04 AC 16 ms
7,792 KB
testcase_05 AC 16 ms
7,860 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,848 KB
testcase_08 AC 16 ms
7,860 KB
testcase_09 AC 20 ms
8,960 KB
testcase_10 AC 32 ms
11,308 KB
testcase_11 AC 40 ms
11,300 KB
testcase_12 AC 59 ms
12,444 KB
testcase_13 AC 72 ms
16,588 KB
testcase_14 AC 78 ms
16,556 KB
testcase_15 AC 109 ms
16,532 KB
testcase_16 AC 161 ms
25,480 KB
testcase_17 AC 16 ms
7,840 KB
testcase_18 AC 16 ms
7,844 KB
testcase_19 AC 16 ms
7,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
nsa = lambda: list(map(str, stdin.readline().split()))
ntp = lambda: tuple(map(int, stdin.readline().split()))
mod = 10 ** 9 + 7
inf = 10 ** 18

n = ni()

st = set()
for i in range(1, n):
    st.add(i ** 2)


n *= n
ans = 0
for i in st:
    if (n - i) in st:
        ans += 1

print(ans)
0