結果

問題 No.347 微分と積分
ユーザー dnish
提出日時 2017-07-10 00:12:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 322 bytes
コンパイル時間 1,516 ms
コンパイル使用メモリ 165,612 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-07 05:03:07
合計ジャッジ時間 2,372 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int) N;i++)
#define p(s) cout<<(s)<<endl
using namespace std;

int main(){
	int n,b;
	double a,in=0,di=0;
	cin>>n>>b;
	REP(i,0,n){
		cin>>a;
		di+=a*pow(b,a-1);
		if(a==-1)in+=log(b);
		else in+=pow(b,a+1)/(a+1);
	}
	printf("%.5lf\n%.5lf\n",di,in);
	return 0;
}
0