Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
12
Task/ABC-Problem/Mathematica/abc-problem.math
Normal file
12
Task/ABC-Problem/Mathematica/abc-problem.math
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
blocks=Partition[Characters[ToLowerCase["BOXKDQCPNAGTRETGQDFSJWHUVIANOBERFSLYPCZM"]],2];
|
||||
ClearAll[DoStep,ABCBlockQ]
|
||||
DoStep[chars_List,blcks_List,chosen_List]:=Module[{opts},
|
||||
If[chars=!={},
|
||||
opts=Select[blcks,MemberQ[#,First[chars]]&];
|
||||
{Rest[chars],DeleteCases[blcks,#,1,1],Append[chosen,#]}&/@opts
|
||||
,
|
||||
{{chars,blcks,chosen}}
|
||||
]
|
||||
]
|
||||
DoStep[opts_List]:=Flatten[DoStep@@@opts,1]
|
||||
ABCBlockQ[str_String]:=(FixedPoint[DoStep,{{Characters[ToLowerCase[str]],blocks,{}}}]=!={})
|
||||
Loading…
Add table
Add a link
Reference in a new issue