結果

問題 No.800 四平方定理
ユーザー toyuzukotoyuzuko
提出日時 2020-08-26 22:22:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 154,916 KB
最終ジャッジ日時 2023-08-07 10:26:25
合計ジャッジ時間 8,834 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
154,248 KB
testcase_01 AC 148 ms
154,372 KB
testcase_02 AC 151 ms
154,396 KB
testcase_03 AC 147 ms
154,588 KB
testcase_04 AC 146 ms
154,512 KB
testcase_05 AC 148 ms
154,568 KB
testcase_06 AC 148 ms
154,512 KB
testcase_07 AC 144 ms
154,648 KB
testcase_08 AC 150 ms
154,532 KB
testcase_09 AC 145 ms
154,560 KB
testcase_10 AC 204 ms
154,560 KB
testcase_11 AC 210 ms
154,704 KB
testcase_12 AC 211 ms
154,444 KB
testcase_13 AC 219 ms
154,684 KB
testcase_14 AC 212 ms
154,604 KB
testcase_15 AC 208 ms
154,676 KB
testcase_16 AC 213 ms
154,444 KB
testcase_17 AC 223 ms
154,604 KB
testcase_18 AC 210 ms
154,440 KB
testcase_19 AC 212 ms
154,632 KB
testcase_20 AC 133 ms
154,016 KB
testcase_21 AC 135 ms
154,048 KB
testcase_22 AC 213 ms
154,524 KB
testcase_23 AC 276 ms
154,532 KB
testcase_24 AC 269 ms
154,676 KB
testcase_25 AC 294 ms
154,700 KB
testcase_26 AC 139 ms
154,052 KB
testcase_27 AC 138 ms
153,972 KB
testcase_28 AC 267 ms
154,560 KB
testcase_29 AC 270 ms
154,752 KB
testcase_30 AC 271 ms
154,428 KB
testcase_31 AC 255 ms
154,916 KB
testcase_32 AC 273 ms
154,616 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