제출 #255218

#제출 시각아이디문제언어결과실행 시간메모리
255218a_playerRoses (BOI20_roses)C++14
0 / 100
1 ms256 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
int main(){
    ll A,B,C,D,N;
    cin>>N>>A>>B>>C>>D;
    if(B*C>A*D){
        swap(A,C);
        swap(B,D);
    }
    ll q=N/A;
    ll sol=q*B;
    ll p=(N%A)/C;
    if(p*C<N%A)p++;
    if(p*D<B)sol+=p*D;
    else sol+=B;
    cout<<sol;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...