70分求调
查看原帖
70分求调
664236
Pursuewind楼主2023/6/22 10:48
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long a, c, p, q, r, x, temp = 0;
    cin >> a >> c >> p >> q >> r >> x;
    if (a < c)
	{
        if ((c - a) * p >= x)
		{
            cout << a + (x / p);
            return 0;
        }
		else
		{
            x -= (c - a) * p;
            temp = c;
            if (q >= x)
			{
                cout << temp - 1;
                return 0;
            }
			else
			{
                x -= q;
                temp += x / r;
                cout << temp;
                return 0;
            }
        }
    }
	else if (a == c)
	{
        if (q >= x)
		{
            cout << temp - 1;
            return 0;
        }
		else
		{
            x -= q;
            temp = c;
            temp += x / r;
            cout << temp - 1;
            return 0;
        }
    }
	else
	{
        temp = a;
        temp += x / r;
        cout << temp - 1;
    }
    return 0;
}

WA: 4 5 10

2023/6/22 10:48
加载中...