原题: The player starts with a prize of $1, and is asked a sequence of n ques- tions. For each question, he may • quit and keep his prize. • answer the question. If wrong, he quits with nothing.If
输入是两个正整数n和k,把从1到2n这2n个数平均分成两份(每份n个数),每份分别排序,排序完成后的数组假设叫a和b,要求abs(ai-bi)>=k, (相同位置的数差的绝对值不少于k),输出有多少种分法。 Backtrack is straighforward, welcome other better solutions: from itertools import combinati