結果

問題 No.1015 おつりは要らないです
ユーザー n_gojon_gojo
提出日時 2020-04-10 18:47:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,153 bytes
コンパイル時間 3,568 ms
コンパイル使用メモリ 74,092 KB
実行使用メモリ 71,572 KB
最終ジャッジ日時 2023-10-13 11:04:59
合計ジャッジ時間 9,423 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 126 ms
55,544 KB
testcase_02 AC 124 ms
55,960 KB
testcase_03 AC 124 ms
55,428 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 124 ms
55,540 KB
testcase_08 AC 124 ms
55,872 KB
testcase_09 AC 123 ms
55,848 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());
        for (int i=0;i<n;i++) {
            int shop = en.get(i);
            while (shop>=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;
                }
            }
        }
        System.out.println("Yes");

    }
}
0