/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 540.0 KiB
#3 Wrong Answer 1ms 452.0 KiB
#4 Wrong Answer 2ms 492.0 KiB
#5 Accepted 1ms 540.0 KiB
#6 Wrong Answer 2ms 516.0 KiB
#7 Wrong Answer 1ms 540.0 KiB
#8 Wrong Answer 1ms 496.0 KiB
#9 Accepted 1ms 540.0 KiB
#10 Wrong Answer 1ms 488.0 KiB
#11 Wrong Answer 1ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;

int main(){
    int X,a,b,c,N,count=0,i;
    cin >> X >>a  >> b >> c >> N;
    vector<ll>p;
    i=0;
    N-=X;
    p.push_back(a);
    p.push_back(b);
    p.push_back(c);
    sort(p.begin(),p.end(),greater<ll>());
    while((i)<=N){
        if(i==N){
            break;
        }
        if((i+=p[0])<=N){
            count++;
        }
        else if((i+=p[1])<=N){
            count++;
        }
        else if((i+=p[2])<=N){
            count++;
        }

    }
    if((i)==N){
        cout << "YES" << endl;
        cout << count << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1028 Magical box and spell
Language
C++20 (G++ 13.2.0)
Submit At
2024-04-02 08:05:14
Judged At
2024-04-02 08:05:14
Judged By
Score
30
Total Time
2ms
Peak Memory
540.0 KiB