結果

問題 No.800 四平方定理
ユーザー heno239heno239
提出日時 2019-03-15 16:26:01
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 435 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 119,776 KB
最終ジャッジ日時 2023-09-14 12:30:59
合計ジャッジ時間 8,554 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
114,624 KB
testcase_01 AC 98 ms
114,840 KB
testcase_02 AC 98 ms
115,136 KB
testcase_03 AC 98 ms
115,068 KB
testcase_04 AC 97 ms
114,976 KB
testcase_05 AC 100 ms
115,352 KB
testcase_06 AC 101 ms
115,080 KB
testcase_07 AC 99 ms
115,184 KB
testcase_08 AC 98 ms
115,292 KB
testcase_09 AC 100 ms
115,164 KB
testcase_10 AC 207 ms
115,556 KB
testcase_11 AC 202 ms
115,304 KB
testcase_12 AC 221 ms
115,680 KB
testcase_13 AC 177 ms
115,832 KB
testcase_14 AC 190 ms
115,796 KB
testcase_15 AC 219 ms
115,592 KB
testcase_16 AC 191 ms
115,700 KB
testcase_17 AC 192 ms
115,552 KB
testcase_18 AC 244 ms
115,536 KB
testcase_19 AC 248 ms
115,504 KB
testcase_20 AC 93 ms
110,164 KB
testcase_21 AC 94 ms
110,188 KB
testcase_22 AC 259 ms
115,636 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 89 ms
110,404 KB
testcase_27 AC 90 ms
110,192 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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