結果

問題 No.800 四平方定理
ユーザー tempura_pptempura_pp
提出日時 2019-03-15 16:27:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,282 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 70,724 KB
最終ジャッジ日時 2023-09-14 12:35:28
合計ジャッジ時間 19,610 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
70,368 KB
testcase_01 AC 63 ms
70,388 KB
testcase_02 AC 60 ms
70,472 KB
testcase_03 AC 61 ms
70,432 KB
testcase_04 AC 60 ms
70,464 KB
testcase_05 AC 62 ms
70,388 KB
testcase_06 AC 69 ms
70,416 KB
testcase_07 AC 65 ms
70,332 KB
testcase_08 AC 68 ms
70,488 KB
testcase_09 AC 64 ms
70,368 KB
testcase_10 AC 620 ms
70,532 KB
testcase_11 AC 663 ms
70,580 KB
testcase_12 AC 689 ms
70,400 KB
testcase_13 AC 579 ms
70,724 KB
testcase_14 AC 625 ms
70,584 KB
testcase_15 AC 697 ms
70,672 KB
testcase_16 AC 645 ms
70,528 KB
testcase_17 AC 637 ms
70,584 KB
testcase_18 AC 736 ms
70,616 KB
testcase_19 AC 741 ms
70,440 KB
testcase_20 AC 52 ms
70,424 KB
testcase_21 AC 54 ms
70,572 KB
testcase_22 AC 754 ms
70,712 KB
testcase_23 AC 1,282 ms
70,620 KB
testcase_24 AC 1,141 ms
70,528 KB
testcase_25 AC 1,277 ms
70,560 KB
testcase_26 AC 52 ms
70,544 KB
testcase_27 AC 53 ms
70,424 KB
testcase_28 AC 1,151 ms
70,400 KB
testcase_29 AC 1,208 ms
70,392 KB
testcase_30 AC 1,147 ms
70,484 KB
testcase_31 AC 1,059 ms
70,724 KB
testcase_32 AC 1,167 ms
70,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
  n,d=map(int,input().split())
  p=[]
  for i in range(1,n+1):
      p.append(i*i)
  cnt=[0]*8000001
  for i in p:
      for j in p:
          s=i-j+d
          if s>=0:
              cnt[s]+=1
  ans=0
  for i in p:
      for j in p:
        ans+=cnt[i+j]
  print(ans)
solve()
0