欧美1区2区3区激情无套,两个女人互添下身视频在线观看,久久av无码精品人妻系列,久久精品噜噜噜成人,末发育娇小性色xxxx

題解 | #瑪雅人的密碼#

瑪雅人的密碼

http://fangfengwang8.cn/practice/761fc1e2f03742c2aa929c19ba96dbb0

def hyx(s: str, index: int):#實現(xiàn)數(shù)字互換
    x = list(s)
    x[index], x[index + 1] = x[index + 1], x[index]
    s = "".join(x)
    return s


def maya(n, x: str):#求解最少次數(shù)
    if "2012" in x:
        return 0
    if x.count("2") < 2 or x.count("1") < 1 or x.count("0") < 1:
        return -1
    ct = 0
    ans = []
    ans.append(x)
    zc = []
    while True:
        ans += zc
        for s in ans:#遍歷每一層
            for i in range(len(s) - 1):#每一層內(nèi)遍歷檢查
                if "2012" in s:
                    return ct
                zc.append(hyx(s, i))
        ct += 1


while True:
    try:
        n = int(input())
        s = input()
        print(maya(n, s))
    except:
        break

全部評論

相關(guān)推薦

05-09 12:23
已編輯
華南理工大學(xué) Java
野豬不是豬??:給他裝的,雙九+有實習(xí)的能看的上這種廠我直接吃⑨?們拿它練練面試愣是給他整出幻覺了
點贊 評論 收藏
分享
評論
點贊
收藏
分享

創(chuàng)作者周榜

更多
??途W(wǎng)
牛客企業(yè)服務(wù)