結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
57,660 KB
testcase_01 AC 134 ms
56,864 KB
testcase_02 AC 132 ms
57,772 KB
testcase_03 AC 118 ms
56,296 KB
testcase_04 AC 120 ms
56,280 KB
testcase_05 AC 129 ms
55,616 KB
testcase_06 WA -
testcase_07 AC 121 ms
56,260 KB
testcase_08 AC 135 ms
57,400 KB
testcase_09 AC 131 ms
57,716 KB
testcase_10 AC 134 ms
57,376 KB
testcase_11 AC 135 ms
57,696 KB
testcase_12 AC 136 ms
57,752 KB
testcase_13 AC 130 ms
57,484 KB
testcase_14 WA -
testcase_15 AC 132 ms
57,656 KB
testcase_16 AC 134 ms
57,548 KB
testcase_17 AC 130 ms
57,656 KB
testcase_18 AC 129 ms
57,468 KB
testcase_19 AC 119 ms
56,360 KB
testcase_20 AC 129 ms
57,520 KB
testcase_21 AC 131 ms
57,656 KB
testcase_22 AC 132 ms
57,644 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