結果

問題 No.800 四平方定理
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-17 22:38:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 326 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 179,660 KB
最終ジャッジ日時 2023-09-22 08:34:37
合計ジャッジ時間 29,313 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
15,520 KB
testcase_01 AC 68 ms
11,144 KB
testcase_02 AC 51 ms
11,116 KB
testcase_03 AC 55 ms
11,136 KB
testcase_04 AC 53 ms
11,204 KB
testcase_05 AC 61 ms
11,116 KB
testcase_06 AC 73 ms
13,780 KB
testcase_07 AC 78 ms
13,748 KB
testcase_08 AC 98 ms
13,752 KB
testcase_09 AC 65 ms
11,116 KB
testcase_10 AC 1,920 ms
91,976 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 1,788 ms
91,860 KB
testcase_14 AC 1,926 ms
91,844 KB
testcase_15 TLE -
testcase_16 AC 1,895 ms
91,920 KB
testcase_17 AC 1,961 ms
92,044 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 19 ms
8,476 KB
testcase_21 AC 19 ms
8,528 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n, d = map(int, input().split())
a = []
for i in range(1, n+1):
    a.append(i**2)

cnt = defaultdict(int)
for x in a:
    for y in a:
        cnt[x+y] += 1

ans = 0
for w in a:
    for z in a:
        if w + d <= z:
            break
        else:
            ans += cnt[w+d-z]
print(ans)
0