hohahola

#pragma comment(linker, "/STACK:102400000,102400000")
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<functional>
#include<math.h>
//#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef queue<int> QI;

void makedata() {
    freopen("input.txt", "w", stdout);
    fclose(stdout);
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    //makedata();
    std::ios::sync_with_stdio(0), cin.tie(0);
    lint n, x, y, z;
    cin >> n >> x >> y >> z;
    if (z >= y) cout << (n * z / x) << endl;
    else {
        lint l = 0, r = n, mid;
        lint ans = 0;
        while (l + 1 < r) {
            mid = (l + r) / 2;
            if ((n - mid) * z >= (x - y) * mid) {
                l = mid;
                ans = max(ans, mid);
            } else r = mid;
        }
        cout << ans << endl;
    }
    return 0;
}
View Code

相关文章: