結果
問題 | No.347 微分と積分 |
ユーザー |
|
提出日時 | 2024-09-19 23:32:49 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 1,980 ms |
コンパイル使用メモリ | 202,616 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-19 23:32:53 |
合計ジャッジ時間 | 2,756 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;int main() {cin.tie(nullptr);ios::sync_with_stdio(false);int N;double B;cin>>N>>B;vector<double> A(N);for(int i=0;i<N;i++)cin>>A[i];double an=0.0,bn=0.0;for(int i=0;i<N;i++){an+=A[i]*pow(B,A[i]-1);if(abs(A[i]+1.0)<0.02){bn+=log(B);}else{bn+=1.0/(A[i]+1.0)*pow(B,A[i]+1);}}cout<<fixed<<setprecision(15)<<an<<"\n"<<bn<<endl;}