code/homework_11.22(1).cpp

26 lines
352 B
C++
Raw Normal View History

2024-11-22 22:58:35 +08:00
#include<iostream>
#include<windows.h>
using namespace std;
int main(){
int tree = 17,wn = 0,clim = 3,down = 1,time = 0;
while (wn < tree)
{
wn += clim;
time ++;
if (wn >= tree)
{
break;
}
wn -= down;
time++;
}
cout <<time<<endl;
return 0;
}