結果
問題 | No.347 微分と積分 |
ユーザー |
![]() |
提出日時 | 2016-02-26 22:41:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 312 bytes |
コンパイル時間 | 2,055 ms |
コンパイル使用メモリ | 158,892 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 22:08:20 |
合計ジャッジ時間 | 2,133 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int n,b; cin>>n>>b; double f=0,F=0; for(int i=0;i<n;i++){ double a; cin>>a; if(a!=0) f+=a*pow((double)b,a-1.0); if(a==-1.0) F+=log((double)b); else F+=pow((double)b,a+1.0)/(a+1.0); } printf("%.15lf\n",f); printf("%.15lf\n",F); return 0; }