2016_QR_C_CoinJam.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:algorithmStudyDayByDay 作者: Eunsol-Lee 项目源码 文件源码
def solve(N, J):
    pairs = 8
    zeros = N - 4 - pairs
    locations = combinations_with_replacement('01234', zeros)

    count = 0

    for result in locations:
        now = 0
        string = ''
        for i in range(zeros):
            while (now != int(result[i])):
                string += '11'
                now += 1
            string += '0'
        while (now < pairs / 2):
            now += 1
            string += '11'
        print ('11%s11 3 2 3 2 7 2 3 2 3' % (string))
        count += 1
        if (count == J):
            return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号