Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
16
Task/Amb/PARI-GP/amb.pari
Normal file
16
Task/Amb/PARI-GP/amb.pari
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Amb(V)={
|
||||
amb(vector(#V,i,vector(#V[i],j,Vec(V[i][j]))),[])
|
||||
};
|
||||
amb(V,s)={
|
||||
if (#V == 0, return(concat(s)));
|
||||
my(v=V[1],U=vecextract(V,2^#V-2),t,final=if(#s,s[#s]));
|
||||
if(#s, s = concat(s,[" "]));
|
||||
for(i=1,#v,
|
||||
if ((#s == 0 | final == v[i][1]),
|
||||
t = amb(U, concat(s, v[i]));
|
||||
if (t, return(t))
|
||||
)
|
||||
);
|
||||
0
|
||||
};
|
||||
Amb([["the","that","a"],["frog","elephant","thing"],["walked","treaded","grows"],["slowly","quickly"]])
|
||||
Loading…
Add table
Add a link
Reference in a new issue