結果

問題 No.800 四平方定理
ユーザー tempura_pptempura_pp
提出日時 2019-03-15 23:07:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 289 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 138,992 KB
最終ジャッジ日時 2023-09-14 14:09:06
合計ジャッジ時間 7,275 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
137,824 KB
testcase_01 AC 99 ms
137,900 KB
testcase_02 AC 97 ms
137,900 KB
testcase_03 AC 97 ms
137,864 KB
testcase_04 AC 102 ms
137,972 KB
testcase_05 AC 99 ms
137,916 KB
testcase_06 AC 97 ms
137,980 KB
testcase_07 AC 100 ms
137,916 KB
testcase_08 AC 96 ms
137,976 KB
testcase_09 AC 98 ms
137,928 KB
testcase_10 AC 177 ms
138,832 KB
testcase_11 AC 179 ms
138,768 KB
testcase_12 AC 185 ms
138,912 KB
testcase_13 AC 162 ms
138,752 KB
testcase_14 AC 162 ms
138,856 KB
testcase_15 AC 183 ms
138,664 KB
testcase_16 AC 164 ms
138,992 KB
testcase_17 AC 164 ms
138,848 KB
testcase_18 AC 200 ms
138,876 KB
testcase_19 AC 201 ms
138,840 KB
testcase_20 AC 88 ms
133,668 KB
testcase_21 AC 87 ms
133,660 KB
testcase_22 AC 204 ms
138,748 KB
testcase_23 AC 289 ms
138,844 KB
testcase_24 AC 240 ms
138,832 KB
testcase_25 AC 283 ms
138,680 KB
testcase_26 AC 90 ms
133,784 KB
testcase_27 AC 90 ms
133,964 KB
testcase_28 AC 241 ms
138,656 KB
testcase_29 AC 268 ms
138,880 KB
testcase_30 AC 242 ms
138,556 KB
testcase_31 AC 229 ms
138,836 KB
testcase_32 AC 252 ms
138,724 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