結果
問題 |
No.347 微分と積分
|
ユーザー |
![]() |
提出日時 | 2018-02-20 23:22:13 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 150 ms / 5,000 ms |
コード長 | 624 bytes |
コンパイル時間 | 3,381 ms |
コンパイル使用メモリ | 74,548 KB |
実行使用メモリ | 54,528 KB |
最終ジャッジ日時 | 2024-09-13 13:02:40 |
合計ジャッジ時間 | 7,585 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
import java.util.Scanner; public class No347 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int B = sc.nextInt(); double a[] = new double[N]; for(int i = 0;i < N;i++) { a[i] = sc.nextDouble(); } double sumbibun = 0; double sumsekibun = 0; for(int i = 0;i < N;i++) { if(a[i] != 0) { sumbibun += a[i] * Math.pow(B, a[i]-1); } if(a[i] != -1) { sumsekibun += Math.pow(B, a[i]+1) / (a[i]+1); }else if(a[i] == -1) { sumsekibun += Math.log(B); } } System.out.println(sumbibun); System.out.println(sumsekibun); } }