結果

問題 No.1015 おつりは要らないです
ユーザー soywatersoywater
提出日時 2020-04-03 22:42:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,162 bytes
コンパイル時間 2,813 ms
コンパイル使用メモリ 73,768 KB
実行使用メモリ 60,976 KB
最終ジャッジ日時 2023-09-16 03:43:46
合計ジャッジ時間 8,288 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,852 KB
testcase_01 AC 122 ms
55,736 KB
testcase_02 AC 124 ms
56,048 KB
testcase_03 AC 124 ms
55,792 KB
testcase_04 WA -
testcase_05 AC 124 ms
55,468 KB
testcase_06 AC 123 ms
56,120 KB
testcase_07 AC 124 ms
55,712 KB
testcase_08 AC 125 ms
55,468 KB
testcase_09 AC 125 ms
55,700 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int Y = sc.nextInt();
		int Z = sc.nextInt();
		int less = -1;
		int ans[] = new int[3];

		int[] list = new int[N];

		for (int i = 0; i < N; i++) {
			list[i] = sc.nextInt();
			ans[0]=0;
			ans[1]=0;
			ans[2]=0;
			less = 0;

			//1000&5000&10000
			for (int c = 0; c <= X; c++) {
				for (int d = 0; d <= Y; d++) {
					for (int e = 0; e <= Z; e++) {
						if (1000 * c + 5000 * d + 10000 * e > list[i]) {
							if(less == 0) {
								less = 1000 * c + 5000 * d + 10000 * e;
								ans[0] = c;
								ans[1] = d;
								ans[2] = e;
								break;
							}else {
								if (less > 1000 * c + 5000 * d + 10000 * e) {
									less = 1000 * c + 5000 * d + 10000 * e;
									ans[0] = c;
									ans[1] = d;
									ans[2] = e;
									break;
								}
							}
						}
					}
				}
			}

			if(less == 0) {
				System.out.println("No");
				break;
			}

			X = X - ans[0];
			Y = Y - ans[1];
			Z = Z - ans[2];
		}

		if(less != 0) {
		System.out.println("Yes");
		}
	}
}
0