結果

問題 No.800 四平方定理
ユーザー NatsubiSoganNatsubiSogan
提出日時 2020-10-17 16:32:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 403 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 80,996 KB
最終ジャッジ日時 2023-09-28 08:22:50
合計ジャッジ時間 11,488 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
13,660 KB
testcase_01 AC 99 ms
10,320 KB
testcase_02 AC 78 ms
9,676 KB
testcase_03 AC 81 ms
9,852 KB
testcase_04 AC 76 ms
9,548 KB
testcase_05 AC 82 ms
9,928 KB
testcase_06 AC 119 ms
10,988 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 103 ms
10,464 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
c1, c2 = [0] * (2 * n ** 2 + 100), [0] * (2 * n ** 2 + 100)
for i in range(1, n + 1):
    for j in range(1, n + 1):
        c1[i ** 2 + j ** 2 - 1] += 1
for i in range(1, n + 1):
    for j in range(1, n + 1):
        if i ** 2 - j ** 2 + d - 1 >= 0:
            c2[i ** 2 - j ** 2 + d - 1] += 1
ans = 0
for i in range(2 * n ** 2 + 1):
    ans += c1[i] * c2[i]
print(ans)
0