結果

問題 No.800 四平方定理
ユーザー pasoconhoshiipasoconhoshii
提出日時 2019-03-18 09:40:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 361 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 140,480 KB
最終ジャッジ日時 2023-09-24 23:08:07
合計ジャッジ時間 8,367 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
139,388 KB
testcase_01 AC 123 ms
139,848 KB
testcase_02 AC 122 ms
140,164 KB
testcase_03 AC 123 ms
139,972 KB
testcase_04 AC 127 ms
140,144 KB
testcase_05 AC 119 ms
139,972 KB
testcase_06 AC 122 ms
139,920 KB
testcase_07 AC 120 ms
139,580 KB
testcase_08 AC 117 ms
139,704 KB
testcase_09 AC 122 ms
139,620 KB
testcase_10 AC 202 ms
139,988 KB
testcase_11 AC 210 ms
140,160 KB
testcase_12 AC 222 ms
140,356 KB
testcase_13 AC 230 ms
140,112 KB
testcase_14 AC 219 ms
139,972 KB
testcase_15 AC 213 ms
140,080 KB
testcase_16 AC 215 ms
140,036 KB
testcase_17 AC 221 ms
140,372 KB
testcase_18 AC 215 ms
140,080 KB
testcase_19 AC 207 ms
140,184 KB
testcase_20 AC 107 ms
134,240 KB
testcase_21 AC 109 ms
134,112 KB
testcase_22 AC 219 ms
140,032 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 105 ms
134,252 KB
testcase_27 AC 106 ms
133,812 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,D = map(int, input().split())

from collections import defaultdict 
# cnt = defaultdict(int)
cnt = [0] * (8*10**6+2)


lst = [ i**2 for i in range(1, N+1)]

for i in range(N):
    for j in range(N):
        cnt[ lst[i] + lst[j] ] += 1


ans = 0

for i in range(N):
    for j in range(N):
        x,y = lst[i], lst[j]
        ans += cnt[ y+D - x ]

print(ans)
0