結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-28 22:46:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 488 bytes |
| コンパイル時間 | 697 ms |
| コンパイル使用メモリ | 60,624 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 12:21:02 |
| 合計ジャッジ時間 | 1,517 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include<iostream>
#include<math.h>
using namespace std;
double bibun(double i, int B) {
return i*pow(B,i-1);
}
double sekibun(double i, int B) {
if (i == -1) {
return log(B);
}
else {
return pow(B,i+1) / (i + 1);
}
}
int main(void) {
int N, B;
cin >> N;
cin >> B;
double *a = new double[N];
double x = 0;
double y = 0;
for (int i = 0; i < N; i++) {
cin >> a[i];
x += bibun(a[i], B);
y += sekibun(a[i], B);
}
cout << x << endl;
cout << y << endl;
return 0;
}