結果

問題 No.800 四平方定理
ユーザー convexineqconvexineq
提出日時 2021-03-25 03:50:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 394 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 138,872 KB
最終ジャッジ日時 2023-08-17 22:55:16
合計ジャッジ時間 8,264 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
76,512 KB
testcase_01 AC 88 ms
77,584 KB
testcase_02 AC 89 ms
77,048 KB
testcase_03 AC 85 ms
77,212 KB
testcase_04 AC 83 ms
76,956 KB
testcase_05 AC 83 ms
77,156 KB
testcase_06 AC 85 ms
77,820 KB
testcase_07 AC 85 ms
77,388 KB
testcase_08 AC 82 ms
77,616 KB
testcase_09 AC 84 ms
77,572 KB
testcase_10 AC 163 ms
107,176 KB
testcase_11 AC 165 ms
111,136 KB
testcase_12 AC 192 ms
110,732 KB
testcase_13 AC 153 ms
108,916 KB
testcase_14 AC 160 ms
111,040 KB
testcase_15 AC 169 ms
111,004 KB
testcase_16 AC 162 ms
111,376 KB
testcase_17 AC 156 ms
111,416 KB
testcase_18 AC 183 ms
111,488 KB
testcase_19 AC 182 ms
111,508 KB
testcase_20 AC 73 ms
71,400 KB
testcase_21 AC 73 ms
71,068 KB
testcase_22 AC 184 ms
111,564 KB
testcase_23 AC 263 ms
138,848 KB
testcase_24 AC 237 ms
138,756 KB
testcase_25 AC 260 ms
138,872 KB
testcase_26 AC 72 ms
71,304 KB
testcase_27 AC 71 ms
71,020 KB
testcase_28 AC 233 ms
138,500 KB
testcase_29 AC 256 ms
138,484 KB
testcase_30 AC 231 ms
138,604 KB
testcase_31 AC 216 ms
134,336 KB
testcase_32 AC 235 ms
138,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d = map(int,input().split())
N = 2*n*n
r = [0]*(N+1)
for x in range(1,n+1):
    for y in range(1,n+1):
        r[x*x+y*y] += 1
ans = 0
for w in range(1,n+1):
    for z in range(1,n+1):
        dd = d + w*w - z*z
        if 0 < dd <= N:
            ans += r[dd]
print(ans)
0