結果

問題 No.347 微分と積分
ユーザー TatsuDX
提出日時 2016-10-16 21:09:33
言語 Java
(openjdk 23)
結果
AC  
実行時間 179 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 3,806 ms
コンパイル使用メモリ 74,376 KB
実行使用メモリ 54,504 KB
最終ジャッジ日時 2024-11-22 12:16:42
合計ジャッジ時間 8,588 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		double x = sc.nextDouble(), t, ans1 = 0, ans2 = 0;
		for (int i = 0; i < n; i++) {
			t = sc.nextDouble();
			ans1 += t * Math.pow(x, t - 1);
			if (t == -1) {
				ans2 += Math.log(x);
			} else {
				ans2 += Math.pow(x, t + 1) / (t + 1);
			}
		}
		System.out.println(ans1);
		System.out.println(ans2);
	}
}
0