結果

問題 No.347 微分と積分
ユーザー drao0113drao0113
提出日時 2016-03-27 03:14:45
言語 Ruby
(3.3.0)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-04-10 00:40:26
合計ジャッジ時間 3,255 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
12,544 KB
testcase_01 AC 89 ms
12,416 KB
testcase_02 AC 87 ms
12,416 KB
testcase_03 AC 87 ms
12,416 KB
testcase_04 AC 86 ms
12,160 KB
testcase_05 AC 89 ms
12,160 KB
testcase_06 AC 86 ms
12,544 KB
testcase_07 AC 89 ms
12,416 KB
testcase_08 AC 85 ms
12,544 KB
testcase_09 AC 86 ms
12,416 KB
testcase_10 AC 84 ms
12,288 KB
testcase_11 AC 85 ms
12,544 KB
testcase_12 AC 85 ms
12,416 KB
testcase_13 AC 86 ms
12,416 KB
testcase_14 AC 85 ms
12,416 KB
testcase_15 AC 86 ms
12,416 KB
testcase_16 AC 87 ms
12,544 KB
testcase_17 AC 85 ms
12,544 KB
testcase_18 AC 86 ms
12,416 KB
testcase_19 AC 86 ms
12,160 KB
testcase_20 AC 87 ms
12,416 KB
testcase_21 AC 87 ms
12,416 KB
testcase_22 AC 85 ms
12,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:29: warning: assigned but unused variable - cnt
Syntax OK

ソースコード

diff #

MODE = "stdio"

tmp = Array.new




if(defined? MODE)
  tmp = STDIN.read.split("\n")
else
  iotmp = "\
  10
  10
  -5.0 2.2 4.6 5.0 -1.0 2.0 0.5 0.3 -3.9 1.5
  ".split("\n")
  iotmp.each{|s|
    tmp << s.strip
  }
end


N = tmp[0].to_i

B = tmp[1].to_i

a = tmp[2].split(" ").map(&:to_f)


cnt=0.0
bibun=0
sekibun=0
a.each do |n|
  bibun += n*B**(n-1)
  if n==-1.0
    sekibun += Math::log(B)
  else
    sekibun += 1/(n+1)*B**(n+1)
  end
end
printf("%.20f\n", bibun)
printf("%.20f\n", sekibun)
0