Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created November 11, 2016 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/1cdee12bbd865991e1c177d3fcd53dad to your computer and use it in GitHub Desktop.
Save whatalnk/1cdee12bbd865991e1c177d3fcd53dad to your computer and use it in GitHub Desktop.
AtCoder ABC #044 A [C++]
#include <iostream>
using namespace std;
int main() {
int n, k, x, y;
cin >> n >> k >> x >> y;
int ret;
if (n <= k){
ret = n * x;
} else {
ret = k * x + (n - k) * y;
}
cout << ret << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment