結果

問題 No.347 微分と積分
ユーザー mizunomi32mizunomi32
提出日時 2016-02-29 22:02:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 624 bytes
コンパイル時間 3,117 ms
コンパイル使用メモリ 74,920 KB
実行使用メモリ 57,680 KB
最終ジャッジ日時 2023-10-24 19:14:32
合計ジャッジ時間 6,917 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,652 KB
testcase_01 AC 141 ms
57,536 KB
testcase_02 AC 133 ms
57,660 KB
testcase_03 AC 134 ms
57,544 KB
testcase_04 AC 120 ms
56,304 KB
testcase_05 AC 117 ms
56,280 KB
testcase_06 WA -
testcase_07 AC 122 ms
56,272 KB
testcase_08 AC 125 ms
55,736 KB
testcase_09 AC 137 ms
57,560 KB
testcase_10 AC 131 ms
57,524 KB
testcase_11 AC 132 ms
57,468 KB
testcase_12 AC 125 ms
56,892 KB
testcase_13 AC 119 ms
56,276 KB
testcase_14 WA -
testcase_15 AC 133 ms
57,524 KB
testcase_16 AC 134 ms
57,268 KB
testcase_17 AC 133 ms
57,352 KB
testcase_18 AC 129 ms
57,628 KB
testcase_19 AC 130 ms
57,632 KB
testcase_20 AC 137 ms
57,680 KB
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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 a;
        double j,k;
        double x1=0,x2=0;
        for (int i=0; i<n;i++){
            a = sc.nextDouble();
            j=a-1.0;
            k=a+1.0;
            x1 += a* Math.pow(b,j);
            if(k==-1.0){
                x2 += Math.log(n);
            }else {
                x2 += 1 / k * Math.pow(b, k);
            }
        }
        System.out.println(x1);
        System.out.println(x2);
    }
}
0