結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2016-02-26 22:48:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,193 bytes |
| コンパイル時間 | 714 ms |
| コンパイル使用メモリ | 90,160 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 22:19:15 |
| 合計ジャッジ時間 | 1,482 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <functional>
#include <set>
#include <ctime>
#include <random>
using namespace std;
template<typename T> istream& operator >> (istream& is, vector<T>& vec){for(T& val: vec) is >> val; return is;}
template<typename T> istream& operator , (istream& is, T& val){ return is >> val;}
template<typename T> ostream& operator << (ostream& os, const vector<T>& vec){for(int i=0; i<vec.size(); i++) os << vec[i] << (i==vec.size()-1?"\n":" ");return os;}
template<typename T> ostream& operator , (ostream& os, T& val){ return os << " " << val;}
template<typename T> ostream& operator >> (ostream& os, T& val){ return os << " " << val;}
using namespace std;
int main(){
int n;
cin >> n;
int b;
cin >> b;
vector<double> a(n);
cin >> a;
double x0 = 0;
for(int i=0; i<n; i++){
x0 += pow(b, a[i]-1) * a[i];
}
double x1 = 0;
for(int i=0; i<n; i++){
if(-1.00001 <= a[i] && a[i] <= -0.999999) x1 += log(b);
else x1 += pow(b, a[i]+1) / (a[i]+1.0);
cerr << x1 << endl;
}
printf("%.18f\n%.18f\n", x0, x1);
return 0;
}
koyumeishi