求助

P1035 [NOIP2002 普及组] 级数求和

Hydra_ @ 2016-09-21 14:53:47

var k,i,j,ans:longint;
       sum:real;
       f:boolean;
begin
    read(k);
    f:=true;
    ans:=0
    while f do 
         begin
             inc(ans);
             sum:=sum+1/ans;
             if sum >k then begin
                                             write(ans);
                                             f:=false;
                                         end;
        end;
end.

by wmh2015 @ 2016-10-04 11:26:04

用数组做


by Wolfycz @ 2016-10-05 22:37:44

你的 ans:=0 后面没打“;”(分号)


|