結果

問題 No.1015 おつりは要らないです
ユーザー n_gojon_gojo
提出日時 2020-04-10 18:44:19
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 1,241 bytes
コンパイル時間 5,244 ms
コンパイル使用メモリ 76,116 KB
実行使用メモリ 73,772 KB
最終ジャッジ日時 2023-10-13 10:58:48
合計ジャッジ時間 9,145 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 116 ms
55,884 KB
testcase_02 AC 116 ms
55,848 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 118 ms
55,604 KB
testcase_08 AC 120 ms
55,752 KB
testcase_09 AC 124 ms
55,980 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.size() >= 0) {
            int shop = en.get(0);
            if (man > 0) {
                shop -= 10000;
                man--;
            } else if (gosen > 0) {
                shop -= 5000;
                gosen--;
            } else {
                sen -= (shop+1)/1000 + 1;
                if (sen < 0) {
                    System.out.println("No");
                    return;
                }
                shop = -1;
            }
            if (shop>=0) {
                en.set(0, shop);
                Collections.sort(en, Collections.reverseOrder());
            } else {
                en.remove(0);
            }
        }
        System.out.println("Yes");

    }
}
0