现在90,第三个点WA
```cpp
var n,i:longint;
a,e:array[1..100000] of longint;
function sc(x:longint):longint;
var sum:longint;
begin
sum:=0;sc:=0;
if x>n then exit(1);
if (e[x-1]=1) and (x>1) then sum:=sum+1;
if (e[x]=1) then sum:=sum+1;
if (sum>a[x]) or (x<>1) and (sum<a[x]-1) then exit(0);
if x=1 then
begin
if a[1]>2 then exit(0);
if a[1]=2 then begin e[x]:=1; e[x+1]:=1; sc:=sc+sc(x+1); end;
if a[1]=1 then begin e[x]:=1; sc:=sc+sc(x+1); e[x]:=0; e[x+1]:=1; sc:=sc+sc(x+1); end;
end
else begin
if sum=a[x] then sc:=sc(x+1)+sc;
if (sum=a[x]-1) and (x<>n) then begin e[x+1]:=1;sc:=sc(x+1)+sc; end;
end;
end;
begin
readln(n);
for i:=1 to n do read(a[i]);
writeln(sc(1));
end.
```
by lamboo @ 2017-11-18 21:59:54
看到pascal就溜了
by stray_233 @ 2017-11-19 16:30:59