結果

問題 No.800 四平方定理
ユーザー heno239heno239
提出日時 2019-03-15 01:02:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 289 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,592 KB
実行使用メモリ 43,260 KB
最終ジャッジ日時 2023-09-14 12:14:10
合計ジャッジ時間 19,960 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
42,948 KB
testcase_01 AC 57 ms
43,132 KB
testcase_02 AC 49 ms
43,060 KB
testcase_03 AC 51 ms
43,064 KB
testcase_04 AC 48 ms
43,168 KB
testcase_05 AC 50 ms
42,988 KB
testcase_06 AC 58 ms
43,120 KB
testcase_07 AC 57 ms
43,000 KB
testcase_08 AC 61 ms
43,132 KB
testcase_09 AC 56 ms
43,064 KB
testcase_10 AC 822 ms
43,004 KB
testcase_11 AC 887 ms
43,020 KB
testcase_12 AC 906 ms
43,140 KB
testcase_13 AC 794 ms
43,072 KB
testcase_14 AC 854 ms
43,072 KB
testcase_15 AC 916 ms
42,992 KB
testcase_16 AC 858 ms
43,064 KB
testcase_17 AC 850 ms
43,260 KB
testcase_18 AC 956 ms
43,064 KB
testcase_19 AC 966 ms
43,004 KB
testcase_20 AC 37 ms
43,072 KB
testcase_21 AC 37 ms
43,132 KB
testcase_22 AC 961 ms
43,136 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 36 ms
43,164 KB
testcase_27 AC 36 ms
43,068 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())
  cnt=[0]*4500001
  for i in range(1,n+1):
      for j in range(1,n+1):
          s=i*i-j*j+d
          if s>=0:
              cnt[s]+=1
  ans=0
  for i in range(1,n+1):
      for j in range(1,n+1):
        ans+=cnt[i*i+j*j]
  print(ans)
solve()
0