rengetsu

Codeforces_466A

Jul 17th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. // Codeforces 466A
  2.  
  3. #include <iostream>
  4. #include <algorithm>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int n, m, a, b, s1 = 0, s2 = 0, s3 = 0, rez;
  11.     cin >> n >> m >> a >> b;
  12.     s1 = n*a;
  13.     s2 = ((n/m)*b)+((n%m)*a);
  14.     s3 = ((n/m)*b)+b;
  15.     rez = min(s1, s2);
  16.     rez = min(rez, s3);
  17.     cout << rez;
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment