結果

問題 No.800 四平方定理
ユーザー lumeffluxlumefflux
提出日時 2019-03-17 23:41:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 273 ms / 2,000 ms
コード長 349 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 201,648 KB
最終ジャッジ日時 2023-09-22 14:40:11
合計ジャッジ時間 8,117 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
201,188 KB
testcase_01 AC 147 ms
201,596 KB
testcase_02 AC 143 ms
201,020 KB
testcase_03 AC 142 ms
201,432 KB
testcase_04 AC 143 ms
201,184 KB
testcase_05 AC 144 ms
201,500 KB
testcase_06 AC 143 ms
201,436 KB
testcase_07 AC 142 ms
201,120 KB
testcase_08 AC 143 ms
201,356 KB
testcase_09 AC 142 ms
201,508 KB
testcase_10 AC 200 ms
201,608 KB
testcase_11 AC 204 ms
201,572 KB
testcase_12 AC 209 ms
201,448 KB
testcase_13 AC 198 ms
201,084 KB
testcase_14 AC 207 ms
201,548 KB
testcase_15 AC 203 ms
201,536 KB
testcase_16 AC 206 ms
201,096 KB
testcase_17 AC 203 ms
201,648 KB
testcase_18 AC 208 ms
201,472 KB
testcase_19 AC 207 ms
201,396 KB
testcase_20 AC 134 ms
200,740 KB
testcase_21 AC 132 ms
200,668 KB
testcase_22 AC 204 ms
201,540 KB
testcase_23 AC 269 ms
201,388 KB
testcase_24 AC 266 ms
201,428 KB
testcase_25 AC 273 ms
201,428 KB
testcase_26 AC 138 ms
200,320 KB
testcase_27 AC 138 ms
200,368 KB
testcase_28 AC 263 ms
201,552 KB
testcase_29 AC 270 ms
201,620 KB
testcase_30 AC 266 ms
201,196 KB
testcase_31 AC 253 ms
201,548 KB
testcase_32 AC 266 ms
201,524 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map(int, input().split())
r1 = [0] * 8000001
r2 = [0] * 8000001
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(8000001):
    ans += r1[i] * r2[i]
print(ans)
0