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.