結果
問題 | No.347 微分と積分 |
ユーザー |
![]() |
提出日時 | 2016-02-27 00:56:07 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,900 bytes |
コンパイル時間 | 2,012 ms |
コンパイル使用メモリ | 164,960 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 10:51:37 |
合計ジャッジ時間 | 2,155 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std ; #define pb(n) push_back(n) #define fi first #define se second #define np string::npos #define X real() #define Y imag() #define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h) #define all(r) (r).begin(),(r).end() #define gsort(st,en) sort((st),(en),greater<int>()) #define vmax(ary) *max_element(all(ary)) #define vmin(ary) *min_element(all(ary)) #define debug(x) cout<<#x<<": "<<x<<endl #define fcout(n) cout<<fixed<<setprecision((n)) #define scout(n) cout<<setw(n) #define rep(i,n) for(int i = 0; i < (int)(n);++i) #define repc(i,a,b) for(int i = (a);i < (int)(b);++i) #define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it) #define repa(n,array) for(auto &n :(array)) typedef long long ll ; typedef deque<int> di ; typedef deque<ll> dl ; typedef map<string,int> dict; typedef complex<double> comd; typedef pair<int,int> pii; constexpr int imax = ((1<<30)-1)*2+1 ; constexpr int inf = 100000000; constexpr double PI = acos(-1.0) ; double eps = 1e-10 ; const int dy[] = {-1,0,1,0}; const int dx[] = {0,-1,0,1}; double CalcDist(comd p1, comd p2){ return sqrt(pow(p1.X - p2.X,2.0) + pow(p1.Y -p2.Y,2.0)); } template <typename T> void out(deque < T > d) { for(size_t i = 0; i < d.size(); i++) { debug(d[i]); } } template<typename T> T ston(string& str, T& n){ istringstream sin(str) ; T num ; sin >> num ; return num ; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int N,B; double dans =0,fans = 0; deque<double> d(N); cin >> N >> B; rep(i,N){ cin >> d[i]; } rep(i,N){ //debug((d[i])*pow(B,d[i]-1)); //debug(1/(d[i]+1) * pow(B,d[i]+1)); dans += (d[i])*pow(B,d[i]-1); if(d[i]+1 != 0){ fans += 1/(d[i]+1) * pow(B,d[i]+1); } else{ fans += log(B); } } fcout(10) << dans << endl; fcout(10) << fans << endl; return 0; }