結果
| 問題 |
No.347 微分と積分
|
| コンテスト | |
| ユーザー |
t8m8⛄️
|
| 提出日時 | 2016-02-26 22:54:35 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 167 ms / 5,000 ms |
| コード長 | 968 bytes |
| コンパイル時間 | 3,533 ms |
| コンパイル使用メモリ | 82,232 KB |
| 実行使用メモリ | 54,856 KB |
| 最終ジャッジ日時 | 2024-09-22 22:29:31 |
| 合計ジャッジ時間 | 8,170 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;
public class No0347 {
static final Scanner in = new Scanner(System.in);
static final PrintWriter out = new PrintWriter(System.out,false);
static boolean debug = false;
static void solve() {
int n = in.nextInt();
int b = in.nextInt();
double[] a = new double[n];
for (int i=0; i<n; i++) {
a[i] = in.nextDouble();
}
double x1 = 0, x2 = 0;
for (int i=0; i<n; i++) {
x1 += a[i]*Math.pow(b, a[i]-1);
x2 += a[i] == -1 ? Math.log(b) : Math.pow(b, a[i]+1)/(a[i]+1);
}
out.printf("%.10f\n",x1);
out.printf("%.10f\n",x2);
}
public static void main(String[] args) {
debug = args.length > 0;
long start = System.currentTimeMillis();
solve();
out.flush();
long end = System.currentTimeMillis();
dump((end-start) + "ms");
in.close();
out.close();
}
static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}
t8m8⛄️