結果

問題 No.800 四平方定理
ユーザー s_shoheis_shohei
提出日時 2020-06-13 14:06:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 1,559 ms
コンパイル使用メモリ 86,520 KB
実行使用メモリ 216,900 KB
最終ジャッジ日時 2023-09-07 08:45:01
合計ジャッジ時間 8,706 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
77,220 KB
testcase_01 AC 89 ms
78,712 KB
testcase_02 AC 76 ms
77,896 KB
testcase_03 AC 73 ms
78,244 KB
testcase_04 AC 73 ms
77,812 KB
testcase_05 AC 70 ms
78,396 KB
testcase_06 AC 72 ms
79,020 KB
testcase_07 AC 75 ms
79,992 KB
testcase_08 AC 74 ms
83,404 KB
testcase_09 AC 72 ms
78,968 KB
testcase_10 AC 147 ms
145,640 KB
testcase_11 AC 156 ms
149,780 KB
testcase_12 AC 160 ms
153,380 KB
testcase_13 AC 141 ms
140,948 KB
testcase_14 AC 148 ms
145,900 KB
testcase_15 AC 167 ms
153,504 KB
testcase_16 AC 150 ms
146,588 KB
testcase_17 AC 157 ms
146,592 KB
testcase_18 AC 193 ms
161,992 KB
testcase_19 AC 175 ms
162,352 KB
testcase_20 AC 65 ms
71,180 KB
testcase_21 AC 61 ms
71,000 KB
testcase_22 AC 178 ms
162,456 KB
testcase_23 AC 255 ms
216,900 KB
testcase_24 AC 222 ms
201,244 KB
testcase_25 AC 252 ms
216,748 KB
testcase_26 AC 63 ms
71,240 KB
testcase_27 AC 73 ms
91,164 KB
testcase_28 AC 238 ms
200,588 KB
testcase_29 AC 248 ms
209,000 KB
testcase_30 AC 253 ms
200,852 KB
testcase_31 AC 220 ms
191,964 KB
testcase_32 AC 240 ms
202,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d = map(int, input().split())

leng=max(1+2*n*n, 1+2*n*n + d)

cnt1=[0]*(leng)
for x in range(1,n+1):
    for y in range(1,n+1):
        cnt1[x**2 + y**2]+=1

cnt2=[0]*(leng)
for w in range(1,n+1):
    for z in range(1,n+1):
        ind = w**2 - z**2 + d
        if ind >= 0:
            cnt2[ind]+=1

ans=0
for i in range(len(cnt1)):
    ans+=(cnt1[i]*cnt2[i])
print(ans)
0