Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Codeforces 466A
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n, m, a, b, s1 = 0, s2 = 0, s3 = 0, rez;
- cin >> n >> m >> a >> b;
- s1 = n*a;
- s2 = ((n/m)*b)+((n%m)*a);
- s3 = ((n/m)*b)+b;
- rez = min(s1, s2);
- rez = min(rez, s3);
- cout << rez;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment