結果

問題 No.347 微分と積分
ユーザー GrenacheGrenache
提出日時 2016-02-26 22:49:30
言語 Java19
(openjdk 21)
結果
AC  
実行時間 153 ms / 5,000 ms
コード長 671 bytes
コンパイル時間 5,904 ms
コンパイル使用メモリ 75,788 KB
実行使用メモリ 57,964 KB
最終ジャッジ日時 2023-10-24 05:29:18
合計ジャッジ時間 10,541 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
57,248 KB
testcase_01 AC 150 ms
57,256 KB
testcase_02 AC 153 ms
57,744 KB
testcase_03 AC 147 ms
57,776 KB
testcase_04 AC 142 ms
57,724 KB
testcase_05 AC 146 ms
57,468 KB
testcase_06 AC 144 ms
57,880 KB
testcase_07 AC 146 ms
57,856 KB
testcase_08 AC 131 ms
56,420 KB
testcase_09 AC 146 ms
57,472 KB
testcase_10 AC 148 ms
57,828 KB
testcase_11 AC 135 ms
56,984 KB
testcase_12 AC 144 ms
57,572 KB
testcase_13 AC 138 ms
57,788 KB
testcase_14 AC 144 ms
57,816 KB
testcase_15 AC 140 ms
57,564 KB
testcase_16 AC 144 ms
57,828 KB
testcase_17 AC 143 ms
57,700 KB
testcase_18 AC 141 ms
57,964 KB
testcase_19 AC 144 ms
57,888 KB
testcase_20 AC 142 ms
57,696 KB
testcase_21 AC 137 ms
54,712 KB
testcase_22 AC 145 ms
57,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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();
    }
}
0