結果

問題 No.1593 Perfect Distance
ユーザー RuteRute
提出日時 2021-07-09 21:48:07
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 251 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 28,256 KB
最終ジャッジ日時 2023-09-14 08:27:40
合計ジャッジ時間 4,117 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
28,256 KB
testcase_01 AC 96 ms
28,152 KB
testcase_02 AC 101 ms
28,120 KB
testcase_03 AC 98 ms
28,188 KB
testcase_04 AC 95 ms
28,076 KB
testcase_05 AC 99 ms
28,104 KB
testcase_06 AC 94 ms
28,220 KB
testcase_07 AC 96 ms
28,056 KB
testcase_08 AC 95 ms
28,116 KB
testcase_09 AC 98 ms
28,080 KB
testcase_10 AC 105 ms
28,200 KB
testcase_11 AC 107 ms
28,192 KB
testcase_12 AC 120 ms
28,068 KB
testcase_13 AC 124 ms
28,252 KB
testcase_14 AC 130 ms
28,116 KB
testcase_15 AC 147 ms
28,072 KB
testcase_16 AC 188 ms
28,152 KB
testcase_17 AC 107 ms
28,076 KB
testcase_18 AC 103 ms
28,148 KB
testcase_19 AC 100 ms
28,204 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