結果

問題 No.800 四平方定理
ユーザー sepa38sepa38
提出日時 2023-03-23 10:10:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 386 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 251,168 KB
最終ジャッジ日時 2023-10-18 19:25:14
合計ジャッジ時間 9,741 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
63,864 KB
testcase_01 AC 56 ms
67,728 KB
testcase_02 AC 55 ms
66,712 KB
testcase_03 AC 53 ms
64,972 KB
testcase_04 AC 55 ms
66,564 KB
testcase_05 AC 56 ms
66,936 KB
testcase_06 AC 55 ms
66,372 KB
testcase_07 AC 57 ms
67,408 KB
testcase_08 AC 53 ms
66,380 KB
testcase_09 AC 55 ms
65,832 KB
testcase_10 AC 206 ms
157,416 KB
testcase_11 AC 227 ms
168,968 KB
testcase_12 AC 224 ms
167,152 KB
testcase_13 AC 195 ms
160,784 KB
testcase_14 AC 202 ms
167,924 KB
testcase_15 AC 227 ms
168,268 KB
testcase_16 AC 193 ms
169,712 KB
testcase_17 AC 202 ms
169,712 KB
testcase_18 AC 214 ms
171,356 KB
testcase_19 AC 215 ms
171,500 KB
testcase_20 AC 38 ms
53,508 KB
testcase_21 AC 38 ms
53,508 KB
testcase_22 AC 219 ms
171,784 KB
testcase_23 AC 386 ms
251,168 KB
testcase_24 AC 312 ms
251,160 KB
testcase_25 AC 357 ms
250,604 KB
testcase_26 AC 38 ms
53,508 KB
testcase_27 AC 37 ms
53,508 KB
testcase_28 AC 358 ms
250,224 KB
testcase_29 AC 363 ms
250,788 KB
testcase_30 AC 343 ms
250,408 KB
testcase_31 AC 298 ms
237,944 KB
testcase_32 AC 354 ms
251,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, d = map(int, input().split())
dis = [0] * (n ** 2 * 4 + 1)
for w in range(1, n+1):
  for x in range(1, n+1):
    dis[x**2-w**2] += 1
yz = [0] * (n ** 2 * 2 + 1)
for y in range(1, n+1):
  for z in range(1, n+1):
     yz[y**2+z**2] += 1
ans = 0
for i in range(n**2*2+1):
  if i - d <= - (n ** 2):
    continue
  ans += yz[i] * dis[i-d]
print(ans)
0