Zju 1710 The Snail又一道模拟题

xiaoxiao2021-03-01  31

本题是道模拟题,又错了好几次,真太不细心了!你聪明的,能先去做做zju 1710 The Snail吗?若你已经AC了,请来告诉我下面的程序错在哪里,谢谢!

#include < iostream > using namespace std; int h,u,d,f; bool flag; int climb() ... {inti=1;doubles=0,t=u,deta=t*f/100;while(true)...{s+=t;if(s>h)...{flag=true;break;}s-=d;if(s<0)...{flag=false;break;}i++;t-=deta;}returni;} bool run() ... {cin>>h>>u>>d>>f;if(h==0)returnfalse;intn=climb();if(flag==true)cout<<"successonday"<<n<<endl;elsecout<<"failureonday"<<n<<endl;returntrue;} int main() ... {while(run());return0;}

读懂题意很重要!细心很重要!保持AC热情很重要!

转载请注明原文地址: https://www.6miu.com/read-3200015.html

最新回复(0)