Guest User

Untitled

a guest
Dec 16th, 2018
56
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main() {
  2. ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  3. ll n, a, b, c;
  4. cin >> n >> a >> b >> c;
  5. ll min1 = LLONG_MAX;
  6. for(long long i = n / 2 - 1; i <= n;i++) {
  7. ll res = ((c + b) * i) / (a + b);
  8. if(min1 > max(max(res * a, (i - res - 1) * b + c * i), (n - i) * a + c * i))
  9. min1 = max(max(res * a, (i - res - 1) * b + c * i), (n - i) * a + c * i);
  10. }
  11. cout << min1;
  12. }
RAW Paste Data