Wrong Answer
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-11-11 03:36:27
- Judged By
- Score
- 10
- Total Time
- 2ms
- Peak Memory
- 544.0 KiB