結果

問題 No.800 四平方定理
ユーザー hogeandfugahogeandfuga
提出日時 2019-03-17 22:06:08
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 386 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 352,316 KB
最終ジャッジ日時 2023-09-22 06:32:05
合計ジャッジ時間 24,946 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
82,328 KB
testcase_01 AC 135 ms
89,232 KB
testcase_02 AC 129 ms
84,760 KB
testcase_03 AC 134 ms
87,548 KB
testcase_04 AC 128 ms
84,424 KB
testcase_05 AC 131 ms
86,528 KB
testcase_06 AC 142 ms
92,672 KB
testcase_07 AC 137 ms
88,064 KB
testcase_08 AC 145 ms
92,316 KB
testcase_09 AC 137 ms
89,452 KB
testcase_10 AC 1,371 ms
247,052 KB
testcase_11 AC 1,463 ms
258,440 KB
testcase_12 AC 1,425 ms
257,936 KB
testcase_13 AC 1,335 ms
257,708 KB
testcase_14 AC 1,426 ms
244,352 KB
testcase_15 AC 1,453 ms
258,040 KB
testcase_16 AC 1,392 ms
244,548 KB
testcase_17 AC 1,417 ms
258,360 KB
testcase_18 AC 1,377 ms
258,280 KB
testcase_19 AC 1,418 ms
258,512 KB
testcase_20 AC 93 ms
71,536 KB
testcase_21 AC 93 ms
71,788 KB
testcase_22 AC 1,501 ms
249,012 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 105 ms
71,544 KB
testcase_27 AC 102 ms
71,844 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n, d = map(int, input().split())

cnt = defaultdict(int)
check = set()
for x in range(1, n+1):
    for y in range(1, n+1):
        tmp = x**2 + y**2
        cnt[tmp] += 1
        if cnt[tmp] == 1:
            check.add(tmp)

ans = 0
for z in range(1, n+1):
    for w in range(1, n+1):
        tmp = w**2 + d - z**2
        ans += cnt[tmp]
print(ans)
0