結果

問題 No.347 微分と積分
ユーザー Mcpu3Mcpu3
提出日時 2018-09-22 15:31:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 171 ms / 5,000 ms
コード長 487 bytes
コンパイル時間 2,103 ms
コンパイル使用メモリ 74,528 KB
実行使用メモリ 57,324 KB
最終ジャッジ日時 2023-09-25 11:05:42
合計ジャッジ時間 7,200 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 169 ms
57,284 KB
testcase_01 AC 166 ms
57,072 KB
testcase_02 AC 170 ms
57,144 KB
testcase_03 AC 171 ms
57,072 KB
testcase_04 AC 169 ms
57,324 KB
testcase_05 AC 167 ms
57,192 KB
testcase_06 AC 169 ms
56,884 KB
testcase_07 AC 168 ms
56,896 KB
testcase_08 AC 168 ms
56,852 KB
testcase_09 AC 167 ms
56,980 KB
testcase_10 AC 166 ms
57,032 KB
testcase_11 AC 165 ms
56,764 KB
testcase_12 AC 169 ms
56,976 KB
testcase_13 AC 163 ms
56,712 KB
testcase_14 AC 166 ms
57,080 KB
testcase_15 AC 164 ms
56,816 KB
testcase_16 AC 164 ms
57,080 KB
testcase_17 AC 163 ms
56,848 KB
testcase_18 AC 163 ms
57,108 KB
testcase_19 AC 165 ms
56,832 KB
testcase_20 AC 164 ms
56,812 KB
testcase_21 AC 164 ms
57,288 KB
testcase_22 AC 169 ms
56,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        double b,a,f=0,F=0;
        int n=sc.nextInt();
        b=sc.nextDouble();
        for(int i=0;i<n;++i){
            a=sc.nextDouble();
            f+=a*Math.pow(b,a-1);
            if(a==-1.)F+=Math.log(Math.abs(b));
            else F+=1/(a+1)*Math.pow(b,a+1);
        }
        sc.close();
        System.out.print(f+"\n"+F);
    }
}
0