結果

問題 No.800 四平方定理
ユーザー 👑 KazunKazun
提出日時 2021-02-25 04:36:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 1,121 ms
コンパイル使用メモリ 81,660 KB
実行使用メモリ 126,624 KB
最終ジャッジ日時 2023-10-25 09:20:12
合計ジャッジ時間 5,847 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
62,252 KB
testcase_01 AC 51 ms
63,200 KB
testcase_02 AC 51 ms
62,860 KB
testcase_03 AC 50 ms
62,964 KB
testcase_04 AC 50 ms
62,812 KB
testcase_05 AC 50 ms
62,936 KB
testcase_06 AC 51 ms
63,432 KB
testcase_07 AC 54 ms
63,156 KB
testcase_08 AC 49 ms
61,256 KB
testcase_09 AC 51 ms
63,252 KB
testcase_10 AC 139 ms
95,056 KB
testcase_11 AC 144 ms
98,904 KB
testcase_12 AC 148 ms
98,300 KB
testcase_13 AC 137 ms
96,524 KB
testcase_14 AC 142 ms
98,900 KB
testcase_15 AC 153 ms
98,672 KB
testcase_16 AC 144 ms
99,276 KB
testcase_17 AC 145 ms
99,280 KB
testcase_18 AC 150 ms
99,136 KB
testcase_19 AC 152 ms
99,184 KB
testcase_20 AC 39 ms
53,408 KB
testcase_21 AC 39 ms
53,408 KB
testcase_22 AC 153 ms
99,280 KB
testcase_23 AC 235 ms
124,736 KB
testcase_24 AC 217 ms
126,620 KB
testcase_25 AC 238 ms
126,436 KB
testcase_26 AC 39 ms
53,408 KB
testcase_27 AC 38 ms
53,408 KB
testcase_28 AC 220 ms
126,308 KB
testcase_29 AC 227 ms
126,496 KB
testcase_30 AC 222 ms
126,372 KB
testcase_31 AC 210 ms
122,024 KB
testcase_32 AC 224 ms
126,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D=map(int,input().split())

T=[0]*(2*N*N+1)
for x in range(1,N+1):
    for y in range(1,N+1):
        T[x*x+y*y]+=1

X=0
for z in range(1,N+1):
    for w in range(1,N+1):
        if 0<=w*w+D-z*z<=2*N*N:
            X+=T[w*w+D-z*z]
print(X)
0