結果
| 問題 |
No.555 世界史のレポート
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-08-12 11:51:56 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 139 ms / 2,000 ms |
| コード長 | 935 bytes |
| コンパイル時間 | 3,245 ms |
| コンパイル使用メモリ | 78,404 KB |
| 実行使用メモリ | 41,748 KB |
| 最終ジャッジ日時 | 2024-10-13 04:46:32 |
| 合計ジャッジ時間 | 6,745 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
import java.io.*;
import java.util.*;
public class Main_yukicoder555_1 {
private static Scanner sc;
private static Printer pr;
private static void solve() {
final int INF = Integer.MAX_VALUE;
int n = sc.nextInt();
int c = sc.nextInt();
int v = sc.nextInt();
int[] dp = new int[n];
Arrays.fill(dp, INF);
dp[0] = 0;
for (int i = 1; i < n; i++) {
for (int j = 1; true; j++) {
int next = i + i * j;
next = Math.min(next, n);
int cost = c + j * v;
dp[next - 1] = Math.min(dp[next - 1], dp[i - 1] + cost);
if (next == n) {
break;
}
}
}
pr.println(dp[n - 1]);
}
// ---------------------------------------------------
public static void main(String[] args) {
sc = new Scanner(System.in);
pr = new Printer(System.out);
solve();
pr.close();
sc.close();
}
private static class Printer extends PrintWriter {
Printer(PrintStream out) {
super(out);
}
}
}