結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2019-11-21 18:11:20 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 148 ms / 5,000 ms |
| コード長 | 619 bytes |
| コンパイル時間 | 2,394 ms |
| コンパイル使用メモリ | 74,180 KB |
| 実行使用メモリ | 41,732 KB |
| 最終ジャッジ日時 | 2024-10-10 19:40:09 |
| 合計ジャッジ時間 | 6,902 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
double b = sc.nextInt();
double[] arr = new double[n];
for (int i = 0; i < n; i++) {
arr[i] = sc.nextDouble();
}
double x1 = 0;
for (int i = 0; i < n; i++) {
x1 += arr[i] * Math.pow(b, arr[i] - 1);
}
System.out.println(x1);
double x2 = 0;
for (int i = 0; i < n; i++) {
if (arr[i] == -1.0) {
x2 += Math.log(b);
} else {
x2 += Math.pow(b, arr[i] + 1) / (arr[i] + 1);
}
}
System.out.println(x2);
}
}
htensai