# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
951122 | turbileg | Roses (BOI20_roses) | C++14 | 1083 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
int main(){
long long n,s,p,k,m,k1,m1,a,b,c,d;
cin >> n >> a >> b >> c >> d;
s = 0;
p = 0;
while(n > s){
m = n - s;
k1 = m / a;
if(m%a > 0) k1++;
k1 = k1 * b;
m1 = m / c;
if(m%c > 0) m1++;
m1 = m1 * d;
if (k1 < m1) s+=a,p+=b;
else s+=c,p+=d;
}
cout << p << endl;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |