题意:

【ZJOI2017 Round1练习】D8T3 stone(Nim游戏)-LMLPHP

【ZJOI2017 Round1练习】D8T3 stone(Nim游戏)-LMLPHP

思路:与其类似的题是HDU5996

HDU5996为判定性问题,稍加改动就可以用来统计方案数

【ZJOI2017 Round1练习】D8T3 stone(Nim游戏)-LMLPHP

 var a:array[..]of longint;
v,cas,i,j,ans,tmp,n,s,k:longint;
begin
assign(input,'stone.in'); reset(input);
assign(output,'stone.out'); rewrite(output);
readln(cas);
for v:= to cas do
begin
readln(n); s:=; k:=;
for i:= to n do
for j:= to <<(i-) do
begin
inc(k); read(a[k]);
if (n-i) mod = then s:=s xor a[k];
end;
//writeln(s);
ans:=; k:=;
for i:= to n do
for j:= to <<(i-) do
begin
inc(k);
if (n-i) mod = then
begin
tmp:= xor (s xor a[k]);
if tmp<a[k] then
begin
if i=n then inc(ans)
else ans:=ans+;
end;
if (i>)and(tmp>a[k])and((k>>)>)and
(a[k>>]>=tmp-a[k]) then inc(ans);
end;
end;
writeln(ans); end; close(input);
close(output);
end.
05-11 16:06