CF382B题解
题目传送门
题意
两个人玩游戏,有
分析
本题为模拟题,按题目思路模拟即可。
一直循环,每次判断
代码
下面是 AC 代码:AC 代码
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,w,x,c;
cin >> a >> b >> w >> x >> c;
int ans = 0;
while(c > a)
{
if(b >= x)
{
b = b - x;
c = c - 1;
}
else
{
a = a - 1;
c = c - 1;
b = w - (x - b);
}
ans++;
}
cout << ans << endl;
return 0;
}