結果

問題 No.800 四平方定理
ユーザー hazohelhazohel
提出日時 2019-03-20 14:53:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 357 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 11,988 KB
実行使用メモリ 139,512 KB
最終ジャッジ日時 2023-10-19 04:23:57
合計ジャッジ時間 25,303 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,998 ms
139,288 KB
testcase_01 TLE -
testcase_02 AC 1,968 ms
134,932 KB
testcase_03 AC 1,954 ms
134,940 KB
testcase_04 AC 1,915 ms
134,940 KB
testcase_05 AC 1,967 ms
134,940 KB
testcase_06 AC 1,930 ms
134,932 KB
testcase_07 AC 1,871 ms
134,932 KB
testcase_08 AC 1,845 ms
134,932 KB
testcase_09 AC 1,864 ms
134,932 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 #

INF = 8000001
left = [0]*INF
right = [0]*INF
N, D = map(int, input().split())

for x in range(1, N+1):
    for y in range(1, N+1):
        left[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 > 0:
            right[w**2 - z**2 + D] += 1
ans = 0;
for i in range(INF):
    ans += left[i] * right[i]
print(ans)
0