题解:P11599 『Fwb』神话の传播

· · 题解

思路

我的思路主要是让他一直跑,没体力就休息,纯纯的暴力,我还以为会超时

代码

#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);//读写优化
    int a,b,c,i=0,d;
    cin>>a>>b>>c;
    d=c;
    while(a>0)
    {
        i++;
        if(c>0)
        {
            c--;
            a=a-b;//一直走走到体力没了为止
        }
        else if(c==0) 
        {
            c=c+d;//体力没了就等待回复体力
        }
    }
    cout<<i;
    return 0;
}