結果

問題 No.1015 おつりは要らないです
ユーザー n_gojon_gojo
提出日時 2020-04-10 18:41:10
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 1,141 bytes
コンパイル時間 3,422 ms
コンパイル使用メモリ 75,108 KB
実行使用メモリ 72,152 KB
最終ジャッジ日時 2023-10-13 10:54:34
合計ジャッジ時間 9,232 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
60,184 KB
testcase_01 AC 123 ms
55,540 KB
testcase_02 AC 123 ms
56,108 KB
testcase_03 AC 126 ms
56,120 KB
testcase_04 AC 127 ms
55,880 KB
testcase_05 AC 126 ms
56,240 KB
testcase_06 AC 126 ms
55,668 KB
testcase_07 AC 126 ms
56,052 KB
testcase_08 AC 127 ms
55,596 KB
testcase_09 AC 127 ms
55,900 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 {
                sen -= (shop+1)/1000 + 1;
                if (sen < 0) {
                    System.out.println("No");
                    return;
                }
                shop = -1;
            }
            en.set(0, shop);
            Collections.sort(en, Collections.reverseOrder());
        }
        System.out.println("Yes");

    }
}
0