結果

問題 No.800 四平方定理
ユーザー lumeffluxlumefflux
提出日時 2019-03-17 23:41:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 349 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 10,640 KB
実行使用メモリ 137,680 KB
最終ジャッジ日時 2023-09-22 15:08:04
合計ジャッジ時間 26,514 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,934 ms
137,348 KB
testcase_01 TLE -
testcase_02 AC 1,906 ms
133,180 KB
testcase_03 TLE -
testcase_04 AC 1,756 ms
132,924 KB
testcase_05 AC 1,981 ms
133,028 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,956 ms
133,092 KB
testcase_09 AC 1,860 ms
132,972 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
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())
r1 = [0] * 8000001
r2 = [0] * 8000001
ans = 0
for x in range(1, N + 1):
    for y in range(1, N + 1):
        r1[x**2 + y**2] += 1
for z in range(1, N + 1):
    for w in range(1, N + 1):
        if w**2 - z**2 + D > 1:
            r2[w**2 - z**2 + D] += 1
for i in range(8000001):
    ans += r1[i] * r2[i]
print(ans)
0