CF382B 题解
题意
如果
不然的话:
求
思路
一直循环。定义变量代表步数,每一次循环判断
判断
代码
#include<iostream>
long long int a,b,w,x,c;
using namespace std;
int main() {
cin>>a>>b>>w>>x>>c;
int ans=0;//步数变量
while(1) {//重复循环
if(c<=a){//判断c是否小于等于a,如果 是 跳出循环
cout<<ans<<endl;
return 0;
}
if(b>=x)b-=x,c--;//判断b是否大于等于x
else a--,c--,b=w-(x-b);//
ans++;//增加步数。
}
return 0;
}