結果

問題 No.842 初詣
ユーザー しゅらにるーとに
提出日時 2024-10-18 21:44:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,325 bytes
コンパイル時間 4,567 ms
コンパイル使用メモリ 230,272 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-18 22:35:53
合計ジャッジ時間 4,723 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353;
using namespace std;
using ll=long long;
using ul=unsigned long long;
int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
int dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};
using Graph=vector<vector<int>>;
int main(){
     vector<int>T(6);
    for(int i=0;i<6;i++)cin>>T[i];
        int x;
        cin>>x;
        while(x>0){
            if(x>=500){
                x-=500;
                T[0]--;
                if(x==0)break;
            }
            else if(x>=100){
                x-=100;
                T[1]--;
                if(x==0)break;
            }
            else if(x>=50){
                x-=50;
                T[2]--;
                if(x==0)break;
            }
            else if(x>=10){
                x-=10;
                T[3]--;
                if(x==0)break;
            }
            else if(x>=5){
                x-=5;
                T[4]--;
                if(x==0)break;
            }
            else {
                x--;
                T[5]--;
                if(x==0)break;
            }
        }
    int t;
    for(int i=0;i<5;i++){
        if(i%2==0)t=5;
        else t=2;
        if(T[i]<0){
            T[i+1]+=T[i]*t;
        }
    }
    if(T[5]>=0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
0