結果

問題 No.347 微分と積分
ユーザー 37kt_
提出日時 2016-03-03 18:18:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 362 bytes
コンパイル時間 1,382 ms
コンパイル使用メモリ 158,804 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 13:50:11
合計ジャッジ時間 2,227 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
  int n, b;
  cin >> n >> b;
  double s = 0, t = 0;
  for (int i = 0; i < n; i++){
    double a;
    cin >> a;
    s += a * pow(b, a - 1);
    if (abs(a + 1.0) < 1e-8) t += log(abs(b));
    else t += pow(b, a + 1) / (a + 1);
  }
  cout << fixed << setprecision(12);
  cout << s << endl << t << endl;
}
0