SHARE
TWEET

Untitled

a guest Dec 16th, 2018 55 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top