結果
問題 | No.347 微分と積分 |
ユーザー |
![]() |
提出日時 | 2016-02-26 22:33:16 |
言語 | C++11 (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 455 bytes |
コンパイル時間 | 380 ms |
コンパイル使用メモリ | 55,072 KB |
最終ジャッジ日時 | 2024-11-14 19:35:05 |
合計ジャッジ時間 | 772 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:17:29: error: ‘pow’ was not declared in this scope 17 | x += a[i] * pow(B, a[i] - 1); | ^~~ main.cpp:18:38: error: ‘log’ was not declared in this scope; did you mean ‘long’? 18 | if (a[i] == -1) y += log((double)B); | ^~~ | long
ソースコード
#include <algorithm>#include <climits>#include <iostream>#include <string>#include <vector>using namespace std;typedef long long ll;int main() {int N, B; cin >> N >> B;vector<double> a(N);for (int i = 0; i < N; i++)cin >> a[i];double x = 0, y = 0;for (int i = 0; i < N; i++) {x += a[i] * pow(B, a[i] - 1);if (a[i] == -1) y += log((double)B);else y += 1 / (a[i] + 1) * pow(B, a[i] + 1);}cout << x << endl << y << endl;}