結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-26 11:38:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 636 bytes |
| コンパイル時間 | 1,596 ms |
| コンパイル使用メモリ | 169,292 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-16 06:24:40 |
| 合計ジャッジ時間 | 2,582 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
const ll INF = 1e10;
const int MOD = 1000000007;
int main(){
int n;
cin >> n;
double b;
cin >> b;
vector<double> a(n);
rep(i,n) cin >> a[i];
double ans1 = 0,ans2 = 0;
rep(i,n){
if(a[i] == -1.0){
ans1 += a[i] * pow(b,a[i]-1);
ans2 += log(b);
}else{
ans1 += a[i] * pow(b,a[i]-1);
ans2 += pow(b,a[i]+1) / (a[i]+1);
}
}
cout << setprecision(20) << ans1 << endl << ans2 << endl;
return 0;
}