結果

問題 No.347 微分と積分
ユーザー t8m8⛄️t8m8⛄️
提出日時 2016-02-26 22:54:35
言語 Java19
(openjdk 21)
結果
AC  
実行時間 177 ms / 5,000 ms
コード長 968 bytes
コンパイル時間 4,924 ms
コンパイル使用メモリ 88,464 KB
実行使用メモリ 58,028 KB
最終ジャッジ日時 2023-10-24 05:38:41
合計ジャッジ時間 8,384 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
57,076 KB
testcase_01 AC 170 ms
57,524 KB
testcase_02 AC 157 ms
57,572 KB
testcase_03 AC 155 ms
57,744 KB
testcase_04 AC 162 ms
57,528 KB
testcase_05 AC 165 ms
57,980 KB
testcase_06 AC 153 ms
57,244 KB
testcase_07 AC 156 ms
57,864 KB
testcase_08 AC 163 ms
57,520 KB
testcase_09 AC 161 ms
57,524 KB
testcase_10 AC 163 ms
57,520 KB
testcase_11 AC 177 ms
57,712 KB
testcase_12 AC 153 ms
57,520 KB
testcase_13 AC 154 ms
57,772 KB
testcase_14 AC 154 ms
57,544 KB
testcase_15 AC 162 ms
57,520 KB
testcase_16 AC 158 ms
57,516 KB
testcase_17 AC 157 ms
57,972 KB
testcase_18 AC 156 ms
57,880 KB
testcase_19 AC 157 ms
57,288 KB
testcase_20 AC 152 ms
57,256 KB
testcase_21 AC 153 ms
57,128 KB
testcase_22 AC 156 ms
58,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class No0347 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static void solve() {
		int n = in.nextInt();
		int b = in.nextInt();
		double[] a = new double[n];
		for (int i=0; i<n; i++) {
			a[i] = in.nextDouble();
		}
		double x1 = 0, x2 = 0;
		for (int i=0; i<n; i++) {
			x1 += a[i]*Math.pow(b, a[i]-1);
			x2 += a[i] == -1 ? Math.log(b) : Math.pow(b, a[i]+1)/(a[i]+1);
		}

		out.printf("%.10f\n",x1);
		out.printf("%.10f\n",x2);
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		dump((end-start) + "ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}
0