凌九傲 @ 2019-02-07 00:01:14
using namespace std; int main() { int K,n=1; double S=0.00; cin>>K; do{ S=S+1.0/n++; }while(K<=S); cout<<n-1; system("pause"); return 0; }
by NaCly_Fish @ 2019-02-07 00:04:38
您交题怎么还用system("pause")啊
by 神迹 @ 2019-02-07 00:07:07
超时,程序问题
by 康师傅 @ 2019-02-07 00:36:12
希望更丰富的展现?使用Markdown
by 灵光一闪 @ 2019-02-07 09:18:38
include<iostream>
include<cstdio>
using namespace std;
int main()
{
int K,n=1;
double S=0.00;
cin>>K;
do
{
S=S+1.0/n++;
}
while(K<=S); cout<<n-1;
^
system("pause"); return 0; }
by 灵光一闪 @ 2019-02-07 09:20:15
啊不是,是while(K<=S)要么成立,要么不成立(死循环
by 灵光一闪 @ 2019-02-07 09:20:22
@凌九傲
by 凌九傲 @ 2019-02-07 21:26:27
@洛谷亿岁 我已经搞定了,谢谢哈
by 灵光一闪 @ 2019-02-09 20:34:39
@凌九傲
没事,懂了就好