結果

問題 No.800 四平方定理
ユーザー ああいいああいい
提出日時 2022-05-29 19:10:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,832 KB
実行使用メモリ 124,680 KB
最終ジャッジ日時 2023-10-21 00:09:38
合計ジャッジ時間 6,111 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
60,308 KB
testcase_01 AC 49 ms
63,304 KB
testcase_02 AC 49 ms
62,964 KB
testcase_03 AC 49 ms
63,068 KB
testcase_04 AC 48 ms
62,916 KB
testcase_05 AC 50 ms
63,040 KB
testcase_06 AC 50 ms
63,536 KB
testcase_07 AC 51 ms
61,144 KB
testcase_08 AC 51 ms
61,364 KB
testcase_09 AC 49 ms
63,356 KB
testcase_10 AC 128 ms
93,104 KB
testcase_11 AC 134 ms
96,952 KB
testcase_12 AC 130 ms
96,348 KB
testcase_13 AC 119 ms
94,572 KB
testcase_14 AC 122 ms
96,960 KB
testcase_15 AC 135 ms
96,720 KB
testcase_16 AC 129 ms
97,336 KB
testcase_17 AC 128 ms
97,328 KB
testcase_18 AC 147 ms
97,184 KB
testcase_19 AC 147 ms
97,232 KB
testcase_20 AC 38 ms
53,508 KB
testcase_21 AC 38 ms
53,508 KB
testcase_22 AC 151 ms
97,328 KB
testcase_23 AC 227 ms
124,672 KB
testcase_24 AC 197 ms
124,680 KB
testcase_25 AC 223 ms
124,484 KB
testcase_26 AC 37 ms
53,508 KB
testcase_27 AC 39 ms
53,508 KB
testcase_28 AC 192 ms
124,356 KB
testcase_29 AC 216 ms
124,552 KB
testcase_30 AC 195 ms
124,420 KB
testcase_31 AC 190 ms
120,072 KB
testcase_32 AC 195 ms
124,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D = map(int,input().split())
C = N * N * 2 + 1
dat = [0] * C
for x in range(1,N + 1):
    u = x * x
    for y in range(1,N + 1):
        dat[u + y * y] += 1
ans = 0
for w in range(1,N + 1):
    u = D + w * w
    for z in range(1, N + 1):
        v = u - z * z
        if 1 <= v < C:
            ans += dat[v]
print(ans)
0