結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-02-26 22:49:30 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 158 ms / 5,000 ms |
| コード長 | 671 bytes |
| コンパイル時間 | 4,261 ms |
| コンパイル使用メモリ | 74,752 KB |
| 実行使用メモリ | 54,520 KB |
| 最終ジャッジ日時 | 2024-09-22 22:21:17 |
| 合計ジャッジ時間 | 8,095 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
import java.util.Scanner;
public class Main_yukicoder347 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int b = sc.nextInt();
double[] a = new double[n];
double x1 = 0;
double x2 = 0;
for (int i = 0; i < n; i++) {
a[i] = sc.nextDouble();
x1 += a[i] * Math.pow(b, a[i] - 1);
if (a[i] == -1) {
x2 += Math.log(b);
} else {
x2 += Math.pow(b, a[i] + 1) / (a[i] + 1);
}
}
System.out.printf("%.5f\n", x1);
System.out.printf("%.5f\n", x2);
sc.close();
}
}