結果

問題 No.800 四平方定理
ユーザー TakoKurageTakoKurage
提出日時 2019-03-17 23:39:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 323 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 87,256 KB
実行使用メモリ 217,200 KB
最終ジャッジ日時 2023-09-22 14:35:20
合計ジャッジ時間 7,292 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
77,376 KB
testcase_01 AC 87 ms
79,052 KB
testcase_02 AC 85 ms
78,100 KB
testcase_03 AC 84 ms
78,336 KB
testcase_04 AC 84 ms
78,096 KB
testcase_05 AC 86 ms
78,256 KB
testcase_06 AC 87 ms
79,260 KB
testcase_07 AC 89 ms
80,176 KB
testcase_08 AC 89 ms
83,496 KB
testcase_09 AC 86 ms
78,896 KB
testcase_10 AC 188 ms
145,760 KB
testcase_11 AC 193 ms
149,804 KB
testcase_12 AC 199 ms
153,668 KB
testcase_13 AC 171 ms
141,036 KB
testcase_14 AC 183 ms
146,112 KB
testcase_15 AC 201 ms
153,780 KB
testcase_16 AC 185 ms
146,924 KB
testcase_17 AC 184 ms
146,780 KB
testcase_18 AC 219 ms
162,172 KB
testcase_19 AC 223 ms
161,980 KB
testcase_20 AC 72 ms
71,396 KB
testcase_21 AC 74 ms
71,412 KB
testcase_22 AC 216 ms
162,412 KB
testcase_23 AC 323 ms
217,200 KB
testcase_24 AC 284 ms
201,392 KB
testcase_25 AC 319 ms
216,636 KB
testcase_26 AC 73 ms
71,428 KB
testcase_27 AC 85 ms
91,532 KB
testcase_28 AC 284 ms
200,932 KB
testcase_29 AC 298 ms
209,196 KB
testcase_30 AC 282 ms
200,928 KB
testcase_31 AC 253 ms
192,224 KB
testcase_32 AC 284 ms
203,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

count1 = [0] * (2 * N * N + 1 + 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 + 1 + 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