Skip to content

Instantly share code, notes, and snippets.

@gedorinku
Last active December 11, 2016 12:14
Show Gist options
  • Save gedorinku/22a1fe6bcf34cd7b072d51ebd6c2939b to your computer and use it in GitHub Desktop.
Save gedorinku/22a1fe6bcf34cd7b072d51ebd6c2939b to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PB push_back
#define PPB pop_back
#define MK make_pair
#define ALL(V) V.begin(), V.end()
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<string, int> psi;
typedef pair<int, pii> pipii;
constexpr int INF = 1LL << 61;
//constexpr int MOD = 1000000007;
//constexpr int MAX_N = 55;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int a, b, c, d, e;
cin >> a >> b >> c >> d >> e;
int ans = 0;
if (a < 0) {
ans += c * (-a) + d;
a = 0;
}
if (0 <= a) {
ans += e * (b - a);
}
cout << ans << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment