結果

問題 No.347 微分と積分
ユーザー wing3196
提出日時 2016-02-26 23:18:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 418 bytes
コンパイル時間 1,263 ms
コンパイル使用メモリ 158,556 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 23:18:57
合計ジャッジ時間 2,036 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
using namespace std;

#define int long long

int N, B;
double A[10];

signed main()
{
	cin >> N >> B;
	double ans1 = 0, ans2 = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
		ans1 += A[i]*pow((double)B, A[i] - 1.0);
		if (abs(A[i] + 1) < 1e-8) ans2 += log(B);
		else ans2 += pow((double)B, A[i] + 1.0)/(A[i] + 1.0);
	}
	printf("%f\n%f\n", ans1, ans2);
	return 0;
}
0