问一下这道题哪里错了??
  • 板块学术版
  • 楼主圣啦啦
  • 当前回复2
  • 已保存回复2
  • 发布时间2021/7/3 20:30
  • 上次更新2023/11/4 18:52:14
查看原帖
问一下这道题哪里错了??
241649
圣啦啦楼主2021/7/3 20:30

https://www.luogu.com.cn/problem/P3926

#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
int main(){
	int a,c,p,q,r,x;
	cin>>a>>c>>p>>q>>r>>x;
	if(a<c){
		int t1=c-a;
		int r1=t1*p;
		if(x>=r1){
			a+=t1;
			x-=r1;
		}else{
			a+=(x/p);
			cout<<a;
			return 0;
		}
	}
	if(a==c){
		x-=q;
	}
	if(x<=0){
		cout<<a;
		return 0;
	}
	if(a>c){
		int t2=c-a;
		int r2=t2*r;
		if(x>=r2){
			a+=t2;
			x-=r2;
		}else{
			a+=(x/r);
			cout<<a;
		}
	}
  	return 0;
}
2021/7/3 20:30
加载中...