code/old_homework/homework_11.22(1).cpp
2024-11-30 07:52:27 +08:00

28 lines
389 B
C++

#include<iostream>
#include<windows.h>
using namespace std;
int main(){
int tree,wn = 0,clim = 3,time = 0;
cin >> tree;
while (wn < tree)
{
wn += clim;
time ++;
if (wn >= tree)
{
break;
}
wn--;
time++;
}
cout <<"需要"<<time<<" 分钟才能爬到树顶"<<endl;
return 0;
}