結果

問題 No.1015 おつりは要らないです
ユーザー deuteridayo
提出日時 2020-04-09 18:36:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 640 bytes
コンパイル時間 1,640 ms
コンパイル使用メモリ 165,904 KB
実行使用メモリ 13,888 KB
最終ジャッジ日時 2024-09-13 15:56:46
合計ジャッジ時間 6,463 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 5 WA * 1 TLE * 1 -- * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x,y,z;
    cin >> n >> x >> y >> z;
    int a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    bool chk = true;
    for(int i=0;i<n;i++){
        while(a[i] > 0){
            if(a[i]>5000 && z>0){
                z--;
                a[i] -= 10000;
            }else if(a[i]>1000 && y>0){
                y--;
                a[i] -= 5000;
            }else if(x>0){
                x--;
                a[i] -= 1000;
            }else{
                chk = false;
                break;
            }
        }
    }
    if(chk)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}
0