結果

問題 No.347 微分と積分
ユーザー ぴろずぴろず
提出日時 2016-02-26 22:37:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 5,000 ms
コード長 563 bytes
コンパイル時間 2,748 ms
コンパイル使用メモリ 74,416 KB
実行使用メモリ 57,880 KB
最終ジャッジ日時 2023-10-24 05:06:20
合計ジャッジ時間 7,180 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
57,676 KB
testcase_01 AC 153 ms
57,672 KB
testcase_02 AC 153 ms
57,520 KB
testcase_03 AC 149 ms
57,328 KB
testcase_04 AC 152 ms
57,788 KB
testcase_05 AC 149 ms
57,768 KB
testcase_06 AC 149 ms
57,668 KB
testcase_07 AC 151 ms
57,768 KB
testcase_08 AC 151 ms
57,696 KB
testcase_09 AC 150 ms
57,736 KB
testcase_10 AC 149 ms
57,332 KB
testcase_11 AC 149 ms
57,828 KB
testcase_12 AC 152 ms
57,532 KB
testcase_13 AC 149 ms
57,800 KB
testcase_14 AC 149 ms
57,800 KB
testcase_15 AC 151 ms
57,584 KB
testcase_16 AC 150 ms
57,536 KB
testcase_17 AC 148 ms
57,880 KB
testcase_18 AC 154 ms
57,768 KB
testcase_19 AC 155 ms
57,304 KB
testcase_20 AC 158 ms
55,488 KB
testcase_21 AC 151 ms
57,552 KB
testcase_22 AC 147 ms
57,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no347;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int b = sc.nextInt();
		double derivative = 0;
		double integral = 0;
		for(int i=0;i<n;i++) {
			double a = sc.nextDouble();
			derivative += a * Math.pow(b, a - 1);
			if (a == -1) {
				integral += Math.log(b);
			}else{
				integral += Math.pow(b, a + 1) / (a + 1);
			}
		}
		pd(derivative);
		pd(integral);
	}
	
	public static void pd(double d) {
		System.out.printf("%.5f\n",d);
	}

}
0