q0q0 @ 2021-09-30 18:10:59
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
int k ;
double ans=1;
int cc=1;
cin >> k;
while(ans>k)
{
cc++;
ans+=1/cc;
}
cout<<cc;
return 0;
}
by linzhaoyumc @ 2021-09-30 18:13:37
@张宇墨是伞兵 是 while(ans<=k)
by linzhaoyumc @ 2021-09-30 18:14:11
while 是在条件成立时执行的
by 卞云珑 @ 2021-09-30 18:16:16
c是一个整形
#include<bits/stdc++.h>
using namespace std ;
int main ()
{
int k ;
double ans=1;
int cc=1;
cin >> k;
while(ans<=k)
{
cc++;
ans+=1.0/cc;
}
cout<<cc;
return 0;
}
by 卞云珑 @ 2021-09-30 18:16:58
改好了,过了
by q0q0 @ 2021-10-01 11:48:13
谢谢!