結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
rickytheta
|
| 提出日時 | 2016-02-26 22:31:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 941 bytes |
| コンパイル時間 | 1,233 ms |
| コンパイル使用メモリ | 159,048 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-22 14:09:05 |
| 合計ジャッジ時間 | 2,073 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD
typedef double Real;
int main(){
int n;
Real b;
cin>>n>>b;
Real a[n];
REP(i,n)cin>>a[i];
cout.precision(10);
// bibun
Real x = 0.0;
REP(i,n){
x += a[i]*pow(b,a[i]-1);
}
cout<<fixed<<x<<endl;
// sekibun
x = 0.0;
REP(i,n){
if(a[i]!=-1.0){
x += pow(b,a[i]+1.0)/(a[i]+1.0);
}else{
x += log(b);
}
// DEBUG(x);
}
cout<<fixed<<x<<endl;
return 0;
}
rickytheta