結果
| 問題 | 
                            No.347 微分と積分
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-02-28 22:39:49 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 486 bytes | 
| コンパイル時間 | 861 ms | 
| コンパイル使用メモリ | 58,980 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-24 12:18:59 | 
| 合計ジャッジ時間 | 1,812 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 3 | 
| other | AC * 4 WA * 16 | 
ソースコード
#include<iostream>
#include<math.h>
using namespace std;
double bibun(double i, int B) {
	return i*pow(B,i);
}
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;
}