#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
int c1, c2 ,c3 ,c4;
c1=((n-1)/a+1)*b;
c3=((n-1)/c+1)*d;
c2=(n/a)*b+(((n%a)-1)/c+1)*d;
c4=(n/c)*d+(((n%c)-1)/a+1)*b;
cout<<min(c1, min(c2, min(c3, c4)))<<"\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |