結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
n_gojo
|
| 提出日時 | 2020-04-10 18:44:19 |
| 言語 | Java (openjdk 23) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,241 bytes |
| コンパイル時間 | 3,628 ms |
| コンパイル使用メモリ | 79,180 KB |
| 実行使用メモリ | 66,852 KB |
| 最終ジャッジ日時 | 2024-09-15 08:00:48 |
| 合計ジャッジ時間 | 9,170 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 2 |
| other | AC * 3 RE * 3 TLE * 1 -- * 26 |
ソースコード
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");
}
}
n_gojo