結果

問題 No.1015 おつりは要らないです
ユーザー n_gojon_gojo
提出日時 2020-04-10 18:36:42
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,102 bytes
コンパイル時間 3,792 ms
コンパイル使用メモリ 75,928 KB
実行使用メモリ 56,380 KB
最終ジャッジ日時 2023-10-13 10:49:23
合計ジャッジ時間 11,382 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,724 KB
testcase_01 AC 127 ms
55,468 KB
testcase_02 AC 125 ms
56,060 KB
testcase_03 AC 125 ms
56,380 KB
testcase_04 AC 125 ms
55,928 KB
testcase_05 AC 125 ms
55,856 KB
testcase_06 AC 125 ms
55,744 KB
testcase_07 AC 126 ms
55,612 KB
testcase_08 AC 125 ms
55,680 KB
testcase_09 AC 125 ms
55,884 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.*;

public class No1015 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int sen = sc.nextInt();
        int gosen = sc.nextInt();
        int man = sc.nextInt();

        List<Integer> en = new ArrayList<>();
        while (sc.hasNext()) {
            en.add(sc.nextInt());
        }
        Collections.sort(en, Collections.reverseOrder());
        while (en.get(0) >= 0) {
            int shop = en.get(0);
            if (man > 0) {
                shop -= 10000;
                man--;
            } else if (gosen > 0) {
                shop -= 5000;
                gosen--;
            } else if (sen > 0) {
                shop -= 1000;
                sen--;
            } else {
                System.out.println("No");
                return;
            }
            en.set(0, shop);
            Collections.sort(en, Collections.reverseOrder());
        }
        System.out.println("Yes");

    }
}
0