結果

問題 No.347 微分と積分
ユーザー TatsuDXTatsuDX
提出日時 2016-10-16 21:09:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 3,552 ms
コンパイル使用メモリ 75,104 KB
実行使用メモリ 41,816 KB
最終ジャッジ日時 2024-05-02 02:30:28
合計ジャッジ時間 6,866 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
41,360 KB
testcase_01 AC 112 ms
40,316 KB
testcase_02 AC 117 ms
40,968 KB
testcase_03 AC 113 ms
40,580 KB
testcase_04 AC 114 ms
40,544 KB
testcase_05 AC 124 ms
41,816 KB
testcase_06 AC 120 ms
41,180 KB
testcase_07 AC 114 ms
40,368 KB
testcase_08 AC 129 ms
41,620 KB
testcase_09 AC 109 ms
40,568 KB
testcase_10 AC 111 ms
40,692 KB
testcase_11 AC 117 ms
40,904 KB
testcase_12 AC 122 ms
41,140 KB
testcase_13 AC 122 ms
40,788 KB
testcase_14 AC 114 ms
40,964 KB
testcase_15 AC 117 ms
41,020 KB
testcase_16 AC 130 ms
41,264 KB
testcase_17 AC 122 ms
41,600 KB
testcase_18 AC 131 ms
41,584 KB
testcase_19 AC 123 ms
41,556 KB
testcase_20 AC 113 ms
40,600 KB
testcase_21 AC 124 ms
41,548 KB
testcase_22 AC 130 ms
41,004 KB
権限があれば一括ダウンロードができます

ソースコード

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