結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2016-02-28 01:03:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 463 bytes |
| コンパイル時間 | 511 ms |
| コンパイル使用メモリ | 58,540 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-24 11:55:46 |
| 合計ジャッジ時間 | 1,355 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int n;
int b;
double a[10];
int main(){
int i;
cin >> n >> b;
for( i = 0; i < n; i++ )
cin >> a[i];
double f = 0;
double F = 0;
for( i = 0; i < n; i++ ){
f += a[i] * pow((double)b, a[i] - 1.0);
if( fabs(a[i] + 1.0) > 1e-6 )
F += 1 / (a[i] + 1) * pow((double)b, a[i] + 1.0);
else
F += log((double)b);
}
printf("%.14f\n", f);
printf("%.14f\n", F);
return 0;
}
startcpp