本题是道模拟题,又错了好几次,真太不细心了!你聪明的,能先去做做zju 1710 The Snail吗?若你已经AC了,请来告诉我下面的程序错在哪里,谢谢!
#include
<
iostream
>
using
namespace
std;
int
h,u,d,f;
bool
flag;
int
climb()
...
{
int
i
=
1
;
double
s
=
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;
}
return
i;
}
bool
run()
...
{
cin
>>
h
>>
u
>>
d
>>
f;
if
(h
==
0
)
return
false
;
int
n
=
climb();
if
(flag
==
true
)
cout
<<
"
successonday
"
<<
n
<<
endl;
else
cout
<<
"
failureonday
"
<<
n
<<
endl;
return
true
;
}
int
main()
...
{
while
(run());
return
0
;
}