結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-10-09 06:54:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 381 bytes |
| コンパイル時間 | 626 ms |
| コンパイル使用メモリ | 74,256 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 06:19:55 |
| 合計ジャッジ時間 | 1,578 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main()
| ^~~~
ソースコード
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int n,b;
double a[10];
main()
{
cin>>n>>b;for(int i=0;i<n;i++)cin>>a[i];
double x=0;
for(int i=0;i<n;i++)x+=a[i]*pow(b,a[i]-1);
cout<<fixed<<setprecision(15)<<x<<endl;
x=0;
for(int i=0;i<n;i++)
{
if(a[i]==-1)x+=log(b);
else x+=pow(b,a[i]+1)/(a[i]+1);
}
cout<<fixed<<setprecision(15)<<x<<endl;
}