結果

問題 No.1015 おつりは要らないです
コンテスト
ユーザー n_gojo
提出日時 2020-04-10 18:52:43
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
WA  
実行時間 -
コード長 1,023 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,659 ms
コンパイル使用メモリ 82,812 KB
実行使用メモリ 62,284 KB
最終ジャッジ日時 2026-04-04 18:36:06
合計ジャッジ時間 35,463 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 9 WA * 14 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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