Python中阶:faro shuffle洗牌
图片 今天的任务有难度。编程思路是关键的关键! 场景:扑克洗牌 通常高手洗牌做到每一张都能洗开。52张牌分成左右平均分两摞,将右手牌第一张插入左手牌第一和第二张之间,依此类推,完美洗开。此称之为faro shuffle洗牌。 faro shuffle洗牌原始的底牌仍然在底部,原始的上牌仍然在顶部。比如如果共有6张牌
['ace', 'two', 'three', 'four', 'five', 'six']
洗第一次顺序变为
['ace', 'four', 'two', 'five', 'three', 'six' ]
If 8 perfect faro shuffles are performed on a deck of 52 playing cards, the deck is restored to its original order. Write a function that inputs an integer n and returns an integer representing the number of faro shuffles it takes to restore a deck of n cards to its original order. Assume n is an even number between 2 and 2000.
如果在一副52张扑克牌上进行8次完美的法罗洗牌,牌组将恢复到原来的顺序。编写一个函数,输入一个整数n并返回一个整数,该整数表示将一组n张牌恢复到其原始顺序所需的faro洗牌次数。 假设n是介于2和2000之间的偶数。

arr = ['A',