結果
問題 |
No.347 微分と積分
|
ユーザー |
|
提出日時 | 2016-12-29 13:06:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 530 bytes |
コンパイル時間 | 760 ms |
コンパイル使用メモリ | 80,420 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-15 07:42:59 |
合計ジャッジ時間 | 1,311 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#define _USE_MATH_DEFINES #include<stdio.h> #include<string> #include<iostream> #include<cctype> #include<cstdio> #include<vector> #include<stack> #include<queue> #include <algorithm> #include<math.h> #include<set> #include<map> #include<iomanip> //#include<bits/stdc++.h> using namespace std; int main() { int n, b; double x=0, y=0, z; cin >> n >> b; while (n--) { cin >> z; x += z*pow(b, z - 1); if (z == -1)y += log(b); else y += pow(b, z + 1) / (z + 1); } cout << x << endl<< y << endl; return 0; }