結果

問題 No.800 四平方定理
ユーザー toyuzukotoyuzuko
提出日時 2020-08-26 22:22:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 334 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 143,488 KB
最終ジャッジ日時 2024-04-25 04:21:04
合計ジャッジ時間 8,968 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
139,520 KB
testcase_01 AC 164 ms
141,056 KB
testcase_02 AC 159 ms
140,800 KB
testcase_03 AC 160 ms
140,800 KB
testcase_04 AC 158 ms
140,928 KB
testcase_05 AC 158 ms
140,544 KB
testcase_06 AC 158 ms
140,672 KB
testcase_07 AC 156 ms
140,416 KB
testcase_08 AC 155 ms
140,288 KB
testcase_09 AC 153 ms
140,800 KB
testcase_10 AC 228 ms
142,464 KB
testcase_11 AC 240 ms
142,208 KB
testcase_12 AC 236 ms
142,336 KB
testcase_13 AC 227 ms
142,592 KB
testcase_14 AC 233 ms
142,464 KB
testcase_15 AC 245 ms
142,336 KB
testcase_16 AC 241 ms
142,592 KB
testcase_17 AC 236 ms
142,592 KB
testcase_18 AC 247 ms
142,592 KB
testcase_19 AC 245 ms
142,592 KB
testcase_20 AC 141 ms
136,448 KB
testcase_21 AC 141 ms
136,320 KB
testcase_22 AC 246 ms
142,720 KB
testcase_23 AC 332 ms
143,232 KB
testcase_24 AC 306 ms
143,104 KB
testcase_25 AC 334 ms
143,232 KB
testcase_26 AC 144 ms
136,192 KB
testcase_27 AC 148 ms
136,192 KB
testcase_28 AC 322 ms
143,104 KB
testcase_29 AC 333 ms
143,232 KB
testcase_30 AC 321 ms
143,232 KB
testcase_31 AC 303 ms
143,488 KB
testcase_32 AC 314 ms
143,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, D = map(int, input().split())

A = [0 for _ in range(5000000)]
B = [0 for _ in range(5000000)]

for x in range(1, N + 1):
    for y in range(1, N + 1):
        s = x**2 + y**2
        if 0 <= s < 5000000:
            A[s] += 1

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

res = 0

for i in range(5000000):
    res += A[i] * B[i]

print(res)
0