2013-09-18 08:23

打表找规律

w[i]:=w[i-1];  奇

w[i]:=w[i-1]+w[i div 2];     偶

//By BLADEVIL
var
    w                   :array[0..1000010] of longint;
    i                   :longint;
    n                   :longint;
begin
    assign(input,'sumset.in'); reset(input);
    assign(output,'sumset.out'); rewrite(output);
    read(n);
    w[1]:=1;
    for i:=2 to n do
        if i mod 2=1 then w[i]:=w[i-1] else w[i]:=(w[i-1]+w[i div 2]) mod 1000000000;
    writeln(w[n]);
    close(input); close(output);
end.

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-18
  • 2021-10-02
  • 2021-11-19
  • 2022-12-23
  • 2021-07-25
  • 2021-08-30
  • 2022-12-23
相关资源
相似解决方案