結果

問題 No.347 微分と積分
ユーザー Mcpu3
提出日時 2018-09-22 15:31:37
言語 Java
(openjdk 23)
結果
AC  
実行時間 177 ms / 5,000 ms
コード長 487 bytes
コンパイル時間 2,070 ms
コンパイル使用メモリ 77,116 KB
実行使用メモリ 55,492 KB
最終ジャッジ日時 2024-07-18 08:58:46
合計ジャッジ時間 6,672 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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