【pascal】求助!为什么只有0分啊

P1035 [NOIP2002 普及组] 级数求和

hzzhengzh @ 2017-02-19 16:49:49

var
  sn:double;
  n,k:int64;
begin
  readln(k);
  sn:=0;
  n:=0;
    if(sn<=k)then
      repeat
        inc(n);
        sn:=1+1/n;

until sn>k;

writeln(n);

end.


by ckbckb @ 2017-03-04 15:49:11

你猜啊


by 爱编程 @ 2017-03-10 13:37:34

var n,k:longint;
    Sn:real;
begin
     readln(k);
     n:=0; Sn:=0;
     repeat
     n:=n+1;
     Sn:=Sn+1/n;
     until Sn>k;
     writeln(n);
end.

by ssllyf @ 2017-03-16 22:07:42

var
  a,b:real;
  j:longint;
begin
  read(a); 
  while b<=a do
    begin
      j:=j+1;
      b:=b+(1/j);
    end;
  write(j);
end.

by 爱编程 @ 2017-03-17 12:54:56

var n,k:longint;
    Sn:real;
begin
     readln(k);
     n:=0; Sn:=0;
     repeat
     n:=n+1;
     Sn:=Sn+1/n;
     until Sn>k;
     writeln(n);
end.

|