fork(3) download
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5.  
  6.  
  7. int main() {
  8. int N, M, A, B;
  9.  
  10. cin>>N;
  11. cin>>M;
  12. cin>>A;
  13. cin>>B;
  14.  
  15. int an,mb;
  16. an=A*N;
  17. for(int i=0; i<N; i+=M)
  18. {
  19. mb+=B;
  20. }
  21. if(an>=mb){
  22. cout<<mb;}
  23. else{
  24. cout<<an;}
  25. return 0;
  26.  
  27. }
  28.  
  29.  
  30.  
Success #stdin #stdout 0.01s 5312KB
stdin
4 10 150 1380
stdout
600