結果

問題 No.800 四平方定理
ユーザー lumeffluxlumefflux
提出日時 2019-03-17 23:37:18
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 385 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 157,624 KB
最終ジャッジ日時 2023-09-22 14:20:27
合計ジャッジ時間 7,760 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
155,320 KB
testcase_01 AC 146 ms
155,492 KB
testcase_02 AC 145 ms
155,764 KB
testcase_03 AC 145 ms
155,524 KB
testcase_04 AC 145 ms
155,672 KB
testcase_05 AC 144 ms
155,756 KB
testcase_06 AC 145 ms
155,684 KB
testcase_07 AC 146 ms
155,748 KB
testcase_08 AC 144 ms
155,820 KB
testcase_09 AC 145 ms
155,620 KB
testcase_10 AC 200 ms
155,760 KB
testcase_11 AC 210 ms
155,772 KB
testcase_12 AC 207 ms
155,712 KB
testcase_13 AC 199 ms
155,848 KB
testcase_14 AC 207 ms
155,948 KB
testcase_15 AC 205 ms
155,832 KB
testcase_16 AC 211 ms
155,856 KB
testcase_17 AC 209 ms
155,940 KB
testcase_18 AC 212 ms
155,848 KB
testcase_19 AC 210 ms
155,852 KB
testcase_20 AC 133 ms
155,084 KB
testcase_21 AC 135 ms
155,144 KB
testcase_22 AC 209 ms
155,708 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 139 ms
154,928 KB
testcase_27 AC 139 ms
154,972 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N, D = map(int, input().split())
r1 = [0] * 5000000
r2 = [0] * 5000000
ans = 0
for x in range(1, N + 1):
    for y in range(1, N + 1):
        r1[x**2 + y**2] += 1
for z in range(1, N + 1):
    for w in range(1, N + 1):
        if w**2 - z**2 + D > 1:
            r2[w**2 - z**2 + D] += 1
for i in range(5000000):
    ans += r1[i] * r2[i]
print(ans)
0