結果

問題 No.800 四平方定理
ユーザー tikitaka1201tikitaka1201
提出日時 2020-09-16 20:29:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 324 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 201,604 KB
最終ジャッジ日時 2023-09-04 03:55:05
合計ジャッジ時間 7,310 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
77,448 KB
testcase_01 AC 85 ms
78,648 KB
testcase_02 AC 84 ms
78,112 KB
testcase_03 AC 86 ms
78,328 KB
testcase_04 AC 81 ms
78,116 KB
testcase_05 AC 84 ms
78,232 KB
testcase_06 AC 84 ms
79,388 KB
testcase_07 AC 84 ms
78,696 KB
testcase_08 AC 82 ms
79,380 KB
testcase_09 AC 84 ms
79,116 KB
testcase_10 AC 192 ms
138,624 KB
testcase_11 AC 200 ms
146,068 KB
testcase_12 AC 205 ms
144,844 KB
testcase_13 AC 180 ms
141,368 KB
testcase_14 AC 184 ms
146,244 KB
testcase_15 AC 200 ms
145,528 KB
testcase_16 AC 190 ms
147,080 KB
testcase_17 AC 188 ms
146,800 KB
testcase_18 AC 208 ms
146,536 KB
testcase_19 AC 208 ms
146,628 KB
testcase_20 AC 68 ms
71,460 KB
testcase_21 AC 69 ms
71,116 KB
testcase_22 AC 209 ms
146,592 KB
testcase_23 AC 308 ms
201,604 KB
testcase_24 AC 277 ms
201,592 KB
testcase_25 AC 324 ms
201,112 KB
testcase_26 AC 71 ms
71,360 KB
testcase_27 AC 71 ms
71,512 KB
testcase_28 AC 294 ms
200,736 KB
testcase_29 AC 312 ms
201,180 KB
testcase_30 AC 291 ms
200,932 KB
testcase_31 AC 280 ms
192,312 KB
testcase_32 AC 297 ms
201,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def MI():
    return map(int, input().split())

n,d=MI()
upper=2*(n**2)
xydic=[0]*(upper+1)
wzdic=[0]*(upper+1)
for i in range(1,n+1):
    for j in range(1,n+1):
        r=i**2-j**2+d
        l=i**2+j**2
        if 0<r<=upper:
            wzdic[r]+=1
        xydic[l]+=1

ans=0
for i in range(1,upper+1):
    ans+=wzdic[i]*xydic[i]
print(ans)
0