C++萌新70分求助
查看原帖
C++萌新70分求助
169606
Jason12楼主2022/2/6 12:44
#include <bits/stdc++.h>
  using namespace std;
long long a,c,p,q,r,x,u,s;
int main()
{
	scanf("%lld%lld%lld%lld%lld%lld",&a,&c,&p,&q,&r,&x);
	u=p*(c-a);
	if (x<=u)
	{
		s=x/p+a;
		printf("%lld\n",s);
	}
	else if (x>u)
	{
		u+=q;
		if (x<=u) printf("%lld\n",c);
		else
		{
			x-=u;
			s=c+x/r;
			printf("%lld\n",s);
		}
	}
	return 0;
}
2022/2/6 12:44
加载中...