結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
170,108 KB
testcase_01 AC 134 ms
170,152 KB
testcase_02 AC 130 ms
170,256 KB
testcase_03 AC 131 ms
170,172 KB
testcase_04 AC 128 ms
169,920 KB
testcase_05 AC 128 ms
170,164 KB
testcase_06 AC 128 ms
170,256 KB
testcase_07 AC 129 ms
170,400 KB
testcase_08 AC 128 ms
170,468 KB
testcase_09 AC 129 ms
170,412 KB
testcase_10 AC 190 ms
170,188 KB
testcase_11 AC 199 ms
170,200 KB
testcase_12 AC 199 ms
170,048 KB
testcase_13 AC 195 ms
170,256 KB
testcase_14 AC 208 ms
170,104 KB
testcase_15 AC 197 ms
170,236 KB
testcase_16 AC 197 ms
170,052 KB
testcase_17 AC 198 ms
169,952 KB
testcase_18 AC 209 ms
170,100 KB
testcase_19 AC 204 ms
170,164 KB
testcase_20 AC 120 ms
169,440 KB
testcase_21 AC 122 ms
169,584 KB
testcase_22 AC 199 ms
170,372 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 125 ms
169,468 KB
testcase_27 AC 125 ms
169,608 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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