結果

問題 No.800 四平方定理
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-17 22:38:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,654 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 259,144 KB
最終ジャッジ日時 2023-09-22 08:35:32
合計ジャッジ時間 23,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
80,016 KB
testcase_01 AC 113 ms
82,700 KB
testcase_02 AC 110 ms
80,564 KB
testcase_03 AC 115 ms
81,524 KB
testcase_04 AC 112 ms
80,920 KB
testcase_05 AC 110 ms
81,648 KB
testcase_06 AC 116 ms
84,800 KB
testcase_07 AC 118 ms
85,648 KB
testcase_08 AC 121 ms
88,960 KB
testcase_09 AC 112 ms
82,960 KB
testcase_10 AC 693 ms
212,088 KB
testcase_11 AC 723 ms
205,016 KB
testcase_12 AC 729 ms
226,524 KB
testcase_13 AC 686 ms
176,132 KB
testcase_14 AC 701 ms
205,028 KB
testcase_15 AC 795 ms
226,440 KB
testcase_16 AC 704 ms
205,052 KB
testcase_17 AC 693 ms
205,084 KB
testcase_18 AC 845 ms
257,680 KB
testcase_19 AC 830 ms
257,332 KB
testcase_20 AC 87 ms
71,664 KB
testcase_21 AC 87 ms
71,364 KB
testcase_22 AC 781 ms
226,632 KB
testcase_23 AC 1,654 ms
259,004 KB
testcase_24 AC 1,529 ms
259,144 KB
testcase_25 AC 1,605 ms
258,916 KB
testcase_26 AC 87 ms
71,672 KB
testcase_27 AC 88 ms
71,540 KB
testcase_28 AC 1,389 ms
258,828 KB
testcase_29 AC 1,450 ms
259,088 KB
testcase_30 AC 1,569 ms
258,812 KB
testcase_31 AC 1,365 ms
248,632 KB
testcase_32 AC 1,454 ms
258,700 KB
権限があれば一括ダウンロードができます

ソースコード

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