結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2021-12-05 01:27:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 680 bytes |
| コンパイル時間 | 786 ms |
| コンパイル使用メモリ | 79,416 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-07 06:53:48 |
| 合計ジャッジ時間 | 1,680 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
int n,b;cin>>n>>b;
vector<double> A(n);
for(int i = 0; n > i; i++){
cin>>A[i];
}
//微分
double ans1 = 0;
for(int i = 0; n > i; i++){
if(A[i] != 0.0){
ans1 += A[i]*pow(b,A[i]-1);
}
}
double ans2 = 0;
for(int i = 0; n > i; i++){
if(A[i] == -1.0){
ans2 += log(b);
//cout << log(b) << " ";
}else{
ans2 += pow(b,A[i]+1)/(A[i]+1);
//cout << pow(b,A[i]+1)/(A[i]+1) << " ";
}
}
//cout << endl;
cout << fixed << setprecision(10) << ans1 << endl;
cout << fixed << setprecision(10) << ans2 << endl;
}