結果
問題 | No.347 微分と積分 |
ユーザー |
|
提出日時 | 2024-09-19 23:32:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 1,636 ms |
コンパイル使用メモリ | 195,296 KB |
最終ジャッジ日時 | 2025-02-24 09:35:49 |
ジャッジサーバーID (参考情報) |
judge4 / 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; }