C++萌新50分求助
查看原帖
C++萌新50分求助
917399
partie楼主2023/5/8 13:45
#include<iostream>
#define int long long
using namespace std;

signed main()
{
    int a,c,p,q,r,x;
    cin>>a>>c>>p>>q>>r>>x;
    int tim1 = p;
    int tim2 = q;
    int tim3 = r;
    bool jd = false;
    if(not(a <= c))jd = true;
    for(int i = 1;i <= x;i++)
    {
        if(a < c)
        {
            if(tim1 == 1)
            {
                a++;
                tim1 = p;
            }
            else tim1--;
        }
        if(a == c and jd == false)
        {
            if(tim2 == 1)
            {
                jd = true;
            }
            else tim2--;
        }
        if(a > c and jd == true)
        {
            if(tim3 == 1)
            {
                a++;
                tim3 = r;
            }
            else tim3--;
        }
    }
    cout<<a;
    return 0;
}
2023/5/8 13:45
加载中...