結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
77,296 KB
testcase_01 AC 86 ms
78,704 KB
testcase_02 AC 86 ms
77,988 KB
testcase_03 AC 86 ms
78,256 KB
testcase_04 AC 84 ms
78,292 KB
testcase_05 AC 86 ms
78,380 KB
testcase_06 AC 86 ms
79,260 KB
testcase_07 AC 88 ms
79,764 KB
testcase_08 AC 90 ms
83,468 KB
testcase_09 AC 84 ms
78,884 KB
testcase_10 AC 187 ms
145,632 KB
testcase_11 AC 190 ms
149,572 KB
testcase_12 AC 196 ms
153,504 KB
testcase_13 AC 169 ms
141,216 KB
testcase_14 RE -
testcase_15 AC 195 ms
153,660 KB
testcase_16 RE -
testcase_17 AC 181 ms
146,612 KB
testcase_18 AC 212 ms
162,268 KB
testcase_19 AC 208 ms
162,072 KB
testcase_20 AC 72 ms
71,272 KB
testcase_21 AC 71 ms
71,444 KB
testcase_22 AC 210 ms
162,364 KB
testcase_23 AC 316 ms
216,976 KB
testcase_24 RE -
testcase_25 AC 324 ms
216,712 KB
testcase_26 RE -
testcase_27 AC 87 ms
91,184 KB
testcase_28 AC 283 ms
200,972 KB
testcase_29 AC 293 ms
208,908 KB
testcase_30 AC 267 ms
201,088 KB
testcase_31 AC 242 ms
192,300 KB
testcase_32 AC 272 ms
203,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = [int(i) for i in input().split()]

count1 = [0] * (2 * N * N + D)
for x in range(1, N + 1):
    for y in range(1, N + 1):
        count1[x * x + y * y] += 1

count2 = [0] * (2 * N * N + D)
for w in range(1, N + 1):
    for z in range(1, N + 1):
        temp = w * w - z * z + D
        if 0 <= temp:
            count2[w * w - z * z + D] += 1

result = 0
for c1, c2 in zip(count1, count2):
    result += c1 * c2

print(result)
0