usaco 月赛 2005 january sumset

时间:2023-12-16 11:21:50

2013-09-18 08:23

打表找规律

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

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

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