var a,x,y:array[0..100] of longint;c:char;pp,i,j,ma,n:longint;
```cpp
function fun(l:longint):longint;
var i,h,h1,s1,p,q:longint;b,b1:array[0..100] of boolean;s:array[0..100] of longint;
begin
fun:=1;
h:=0;
fillchar(b,sizeof(b),true);
s1:=a[l];
p:=1;q:=0;h1:=0;
while (b[s1]=true) and (p>q) do
begin
b[s1]:=false;
fillchar(b1,sizeof(b1),true);
h:=0;
for i:=1 to n do
begin
if (s1=x[i]) and (b1[y[i]]=true) then begin
if (y[i]=s1) then begin
b1[y[i]]:=false;
continue;
end;
if (l=1) and (y[i]<>0) then begin
inc(h);
b1[y[i]]:=false;
if b[y[i]]=true then begin
s[p]:=y[i];
inc(p);
end;
end;
if (l<>1) then begin
inc(h);
b1[y[i]]:=false;
if b[y[i]]=true then begin
s[p]:=y[i];
inc(p);
end;
end;
end;
end;
if h>h1 then begin h1:=h;end;
inc(q);s1:=s[q];
end;
if l=pp then begin
if h1=0 then begin exit(1);end;
if h1>0 then begin exit(h1+1);end;
end
else begin
fun:=fun(l+1)*(h1+1);
end;
end;
begin
read(c);
pp:=0;
while c<>' ' do
begin
inc(pp);
a[pp]:=ord(c)-48;
read(c);
end;
readln(n);
ma:=0;
for i:=1 to n do
read(x[i],y[i]);
ma:=fun(1);
writeln(ma);
end.
现在是开大范围之后的代码。60分,最后两个RE
```
by zhanghanning @ 2017-11-07 19:54:20
有大佬来帮助我吗?
by zhanghanning @ 2017-11-07 20:34:34
第四个数据要int64,第五个int64不够要高精(22位)
by jinhaoxian @ 2018-06-25 21:31:24