結果
問題 | No.27 板の準備 |
ユーザー | kano_town |
提出日時 | 2014-11-22 21:48:19 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 809 bytes |
コンパイル時間 | 3,132 ms |
コンパイル使用メモリ | 74,356 KB |
実行使用メモリ | 58,592 KB |
最終ジャッジ日時 | 2023-08-30 22:13:51 |
合計ジャッジ時間 | 6,774 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
56,392 KB |
testcase_01 | AC | 126 ms
56,736 KB |
testcase_02 | AC | 125 ms
56,384 KB |
testcase_03 | AC | 124 ms
56,144 KB |
testcase_04 | AC | 129 ms
56,372 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 129 ms
55,860 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 134 ms
56,104 KB |
testcase_14 | WA | - |
testcase_15 | AC | 131 ms
56,240 KB |
testcase_16 | AC | 131 ms
56,160 KB |
testcase_17 | AC | 131 ms
56,092 KB |
ソースコード
import java.util.Arrays; import java.util.Scanner; public class Yukicoder27 { static int[][] pat = {{0, 1, 2, 3}, {0, 1, 3, 2}, {0, 2, 3, 1}, {1, 2, 3, 0}}; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int[] V = new int[4]; for (int i = 0; i < 4; i++) V[i] = sc.nextInt(); Arrays.sort(V); int[] board = new int[3]; int min = Integer.MAX_VALUE; for (int i = 0; i < 4; i++) { board[0] = V[pat[i][0]]; board[1] = V[pat[i][1]]; board[2] = V[pat[i][2]]; for (int j = 0; j < 30; j++) { for (int k = 0; k < 30; k++) { for (int l = 0; l < 30; l++) { if (board[0] * j + board[1] * k + board[2] * l == V[pat[i][3]]) min = Math.min(min, j+k+l); } } } } System.out.println(min + 3); } }