結果
| 問題 | No.347 微分と積分 |
| コンテスト | |
| ユーザー |
37zigen
|
| 提出日時 | 2016-04-11 19:22:40 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 106 ms / 5,000 ms |
| コード長 | 636 bytes |
| 記録 | |
| コンパイル時間 | 2,446 ms |
| コンパイル使用メモリ | 82,076 KB |
| 実行使用メモリ | 42,432 KB |
| 最終ジャッジ日時 | 2026-04-20 03:56:15 |
| 合計ジャッジ時間 | 6,796 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args)throws Exception{
new Main().solve();
}
void solve(){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int b=sc.nextInt();
double[] a=new double[n];
for(int i=0;i<n;i++){
a[i]=sc.nextDouble();
}
double f=0,F=0;
for(int i=0;i<n;i++){
f+=a[i]*Math.pow(b, a[i]-1);
if(a[i]==-1){
F+=Math.log((b));
}else{
F+=Math.pow(b, a[i]+1)/(a[i]+1);
}
}
System.out.println(f);
System.out.println(F);
}
//a^n
// double pow(double a,double n){
// if(n<0)return 1/Math.pow(a,n);
// else return Math.pow(a, n);
// }
}
37zigen