dblark @ 2017-04-08 11:45:07
var
n,x:integer;
s:real;
begin
read(n);
x:=0;
s:=0;
repeat
inc(x);
s:=s+1/x;
until s>n;
writeln(x);
end.
by szfcpp @ 2017-04-16 20:37:48
x用integer一定会溢出(integer最大32767,n为15时答案是183万多)。
by bhx2004 @ 2017-04-25 13:41:11
var
k,i:integer;
n:int64;
sn:real;
a:boolean;
begin
read(k);
repeat
n:=n+1;
sn:=sn+1/n;
if sn>k then
a:=true;
until a;
write(n);
end.
by bhx2004 @ 2017-04-25 13:42:01
好吧,i并没有什么用