- 笨笨的果实采摘
- 2009-07-31 20:18:17 @
为什么只有60分呢?
哪里考虑错了吗?
type
rec=record
floor:integer;
value:integer;
end;
var
a:array[1..1000]of rec;
t:longint;
floor:integer;
n,u,d:longint;
ans:longint;
i:longint;
s:string;
procedure work(k:string);
var
if0,if1:boolean;
i:longint;
left,right:string;
begin
inc(t);
a[t].floor:=floor;
if length(k)=1 then
begin
if k='1' then a[t].value:=2 else a[t].value:=5;
exit;
end;
if0:=false;
if1:=false;
for i:=1 to length(k) do
begin
if k[i]='0'then if0:=true;
if k[i]='1'then if1:=true;
end;
if (if0)and(if1)then a[t].value:=1;
if (if1)and(not if0) then a[t].value:=2;
if (if0)and(not if1) then a[t].value:=5;
left:=copy(k,1,length(k) div 2);
right:=copy(k,length(k) div 2+1,length(k));
inc(floor);
work(left);
work(right);
dec(floor);
end;
begin
readln(n);
readln(u,d);
readln(s);
t:=0;
floor:=0;
work(s);
ans:=0;
for i:=1 to t do
if (a[i].floor>=d) and(a[i].floor