結果

問題 No.800 四平方定理
ユーザー hanamihanami
提出日時 2019-04-09 19:54:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 320 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 10,640 KB
実行使用メモリ 115,388 KB
最終ジャッジ日時 2023-09-18 01:44:53
合計ジャッジ時間 37,446 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 185 ms
35,076 KB
testcase_01 AC 212 ms
31,952 KB
testcase_02 AC 182 ms
31,036 KB
testcase_03 AC 191 ms
31,340 KB
testcase_04 AC 189 ms
30,980 KB
testcase_05 AC 194 ms
31,308 KB
testcase_06 AC 214 ms
32,104 KB
testcase_07 AC 212 ms
33,000 KB
testcase_08 AC 253 ms
36,376 KB
testcase_09 AC 211 ms
31,764 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 135 ms
29,532 KB
testcase_21 AC 130 ms
29,696 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D=map(int,input().split())
import numpy as np
zw_list=np.array([0]*(2*N**2+D+1))
ans=0
for z in range(1,N+1):
    for w in range(1,N+1):
        cal=D-z**2+w**2
        if cal>0:
            zw_list[cal]+=1            
for x in range(1,N+1):
    for y in range(1,N+1):
        ans+=zw_list[x**2+y**2]
print(ans)       
0