結果

問題 No.1593 Perfect Distance
ユーザー RuteRute
提出日時 2021-07-09 21:48:07
言語 Python3
(3.10.1 + numpy 1.22.3 + scipy 1.8.0)
結果
AC  
実行時間 319 ms / 2,000 ms
コード長 251 bytes
コンパイル時間 101 ms
使用メモリ 27,948 KB
最終ジャッジ日時 2023-02-01 22:56:37
合計ジャッジ時間 4,971 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 141 ms
27,948 KB
testcase_01 AC 141 ms
27,692 KB
testcase_02 AC 143 ms
27,832 KB
testcase_03 AC 142 ms
27,776 KB
testcase_04 AC 143 ms
27,916 KB
testcase_05 AC 142 ms
27,692 KB
testcase_06 AC 143 ms
27,740 KB
testcase_07 AC 141 ms
27,776 KB
testcase_08 AC 143 ms
27,940 KB
testcase_09 AC 150 ms
27,936 KB
testcase_10 AC 167 ms
27,884 KB
testcase_11 AC 182 ms
27,728 KB
testcase_12 AC 207 ms
27,864 KB
testcase_13 AC 214 ms
27,836 KB
testcase_14 AC 225 ms
27,884 KB
testcase_15 AC 267 ms
27,776 KB
testcase_16 AC 319 ms
27,940 KB
testcase_17 AC 142 ms
27,824 KB
testcase_18 AC 141 ms
27,732 KB
testcase_19 AC 142 ms
27,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#問題文
#x²+y²=N²を満たすものはいくつありますか?
N = int(input())
ans = 0
ls = []
for i in range(1,200001):
    ls.append(i ** 2)
P = set(ls)
for i in range(1,N):
    if N **2 - i ** 2  in P:        
        ans += 1
print(ans)
0