結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,552 KB
testcase_01 AC 128 ms
57,512 KB
testcase_02 AC 133 ms
57,572 KB
testcase_03 AC 135 ms
57,692 KB
testcase_04 AC 131 ms
57,352 KB
testcase_05 AC 133 ms
57,272 KB
testcase_06 WA -
testcase_07 AC 136 ms
57,604 KB
testcase_08 AC 143 ms
57,568 KB
testcase_09 AC 131 ms
57,396 KB
testcase_10 AC 134 ms
57,660 KB
testcase_11 AC 127 ms
55,040 KB
testcase_12 AC 138 ms
57,336 KB
testcase_13 AC 139 ms
57,728 KB
testcase_14 WA -
testcase_15 AC 144 ms
57,788 KB
testcase_16 AC 148 ms
57,596 KB
testcase_17 AC 132 ms
57,688 KB
testcase_18 AC 133 ms
57,508 KB
testcase_19 AC 135 ms
57,804 KB
testcase_20 AC 141 ms
57,584 KB
testcase_21 AC 123 ms
56,892 KB
testcase_22 AC 119 ms
56,276 KB
権限があれば一括ダウンロードができます

ソースコード

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