我叫雷锋

P1035 [NOIP2002 普及组] 级数求和

土间太平 @ 2017-09-24 14:00:24

下面WAAC代码

var sn:real;
    k,i:longint;
begin
 readln(k);
 for i:=1 to 10000000 do
  if sn>k then break
          else sn:=sn+1/i;
 writeln(i-1);
end.

by 徒司王 @ 2017-09-24 14:17:58

赞赞赞赞赞赞赞赞


by lzx_carl @ 2017-09-24 15:07:13

我是雷锋他爸


by 徐靖凌 @ 2017-09-26 15:32:47

123


by 徐靖凌 @ 2017-09-26 15:33:16

666


by 徐靖凌 @ 2017-09-26 15:44:53

132222222222222222222222


by 徐靖凌 @ 2017-09-26 15:50:12

66666666666666666


by Harry_Chen @ 2017-09-30 18:06:33

@(长河落日圆)[https://www.luogu.org/space/show?uid=59364]雷锋做好事不留名


by Delta_Cosh @ 2017-10-14 00:20:29

你这个并不是通用代码。一旦数据大了你的算法不仅可能TLE,更可能会错误。


|