結果
| 問題 | No.496 ワープクリスタル (給料日前編) |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-12-10 11:45:00 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 83 ms / 2,000 ms |
| コード長 | 867 bytes |
| 記録 | |
| コンパイル時間 | 1,617 ms |
| コンパイル使用メモリ | 82,144 KB |
| 実行使用メモリ | 48,108 KB |
| 最終ジャッジ日時 | 2026-04-08 07:37:43 |
| 合計ジャッジ時間 | 4,591 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int gx = sc.nextInt();
int gy = sc.nextInt();
int n = sc.nextInt();
int f = sc.nextInt();
int[][] costs = new int[gx + 1][gy + 1];
for (int i = 0; i <= gx; i++) {
for (int j = 0; j <= gy; j++) {
costs[i][j] = (i + j) * f;
}
}
for (int i = 0; i < n; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
int c = sc.nextInt();
for (int j = gx; j - x >= 0; j--) {
for (int k = gy; k - y >= 0; k--) {
costs[j][k] = Math.min(costs[j][k], costs[j - x][k - y] + c);
}
}
}
System.out.println(costs[gx][gy]);
}
}
tenten