結果

問題 No.1015 おつりは要らないです
ユーザー n_gojon_gojo
提出日時 2020-04-10 18:52:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,023 bytes
コンパイル時間 3,323 ms
コンパイル使用メモリ 72,608 KB
実行使用メモリ 66,968 KB
最終ジャッジ日時 2023-10-13 11:18:18
合計ジャッジ時間 46,672 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 124 ms
55,808 KB
testcase_02 AC 123 ms
55,656 KB
testcase_03 AC 124 ms
56,076 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 127 ms
55,880 KB
testcase_08 AC 126 ms
56,180 KB
testcase_09 AC 126 ms
56,036 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 125 ms
55,640 KB
testcase_31 AC 514 ms
60,348 KB
testcase_32 AC 498 ms
60,628 KB
testcase_33 TLE -
testcase_34 AC 127 ms
55,608 KB
testcase_35 WA -
testcase_36 AC 126 ms
55,772 KB
権限があれば一括ダウンロードができます

ソースコード

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()) {
            int shop = sc.nextInt();
            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