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