首页
社区
课程
招聘
[原创]第四题 英雄救美
发表于: 2021-5-14 21:56 6516

[原创]第四题 英雄救美

2021-5-14 21:56
6516

没心情写wp了,这个题出的,我不想吐槽了。很脑洞不直观
我只想喷出题者。按照他的check,如果不去直接地从最后数独出发。最直接的想法就有 9 ** 55 种可能。

想了好久,最后脑洞出来了。

table = "$BPV:ubfYp}]DtN>aT^MGmJQ#*Hr`O'wjic0!hdy{oZz-@n+?&%s_/g<e[W)XUxRFSLRA;.l=CEkvK-(q"
 
# b = [0, 4, 0, 7, 0, 0, 0, 0, 0, 9, 2, 0, 0, 0, 0, 6, 0, 7, 8, 3, 0, 0, 0, 5, 4, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 4, 9, 0, 0, 0, 7, 1, 3, 0, 5, 0, 0, 0, 0, 9, 4, 0, 0, 0, 0, 0, 8, 0, 6, 0, 0]
# import string
# for i in range(9):
#     print(a[i*9:i*9 + 9])
 
# for i in range(9):
#     print(b[i*9:i*9 + 9])  
 
# c = []
# zero_count = 0
# aim = [[5,4,6,7,1,9,2,3,8],[9,2,1,8,3,4,6,5,7],[8,3,7,6,2,5,4,1,9],[7,1,8,4,6,3,9,2,5],[4,5,3,2,9,1,7,8,6],[6,9,2,5,8,7,1,4,3],[2,8,4,9,5,6,3,7,1],[3,6,5,1,7,2,8,9,4],[1,7,9,3,4,8,5,6,2]]
# for i in range(81):
#     if b[i] == 0:
#         zero_count += 1
#         c.append(aim[i // 9][i % 9])
# print(c)
# print(len(c))
# print(zero_count)
# idx = 0
# for i in range(len(a)):
#     if (i % 9 + 1) == c[idx]:
#         print(a[i], end="")
#         idx += 1
# print("")
# print(idx)
 
a = [[0, 4, 0, 7, 0, 0, 0, 0, 0], [9, 2, 0, 0, 0, 0, 6, 0, 7], [8, 3, 0, 0, 0, 5, 4, 0, 0], [0, 1, 0, 0, 0, 3, 0, 0, 0], [0, 0, 0, 2, 0, 1, 0, 0, 0], [0, 0, 0, 5, 0, 0, 0, 4, 0], [0, 0, 4, 9, 0, 0, 0, 7, 1], [3, 0, 5, 0, 0, 0, 0, 9, 4], [0, 0, 0, 0, 0, 8, 0, 6, 0]]
b = [[5,4,6,7,1,9,2,3,8],[9,2,1,8,3,4,6,5,7],[8,3,7,6,2,5,4,1,9],[7,1,8,4,6,3,9,2,5],[4,5,3,2,9,1,7,8,6],[6,9,2,5,8,7,1,4,3],[2,8,4,9,5,6,3,7,1],[3,6,5,1,7,2,8,9,4],[1,7,9,3,4,8,5,6,2]]
c = []
for i in range(9):
    c.append(table[i*9:i*9+9])
print(c)
out = ""
for i in range(9):
    aim = a[i]
    get = b[i]
    index_t = c[i]
    cout = 0
    for j in range(9):
        if aim[j] == 0:
            out += index_t[get[j] - 1]
            cout += 1
    out += str(9 - cout)
print(out)
print(len(out))
table = "$BPV:ubfYp}]DtN>aT^MGmJQ#*Hr`O'wjic0!hdy{oZz-@n+?&%s_/g<e[W)XUxRFSLRA;.l=CEkvK-(q"
 
# b = [0, 4, 0, 7, 0, 0, 0, 0, 0, 9, 2, 0, 0, 0, 0, 6, 0, 7, 8, 3, 0, 0, 0, 5, 4, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 4, 9, 0, 0, 0, 7, 1, 3, 0, 5, 0, 0, 0, 0, 9, 4, 0, 0, 0, 0, 0, 8, 0, 6, 0, 0]
# import string
# for i in range(9):
#     print(a[i*9:i*9 + 9])
 
# for i in range(9):
#     print(b[i*9:i*9 + 9])  
 
# c = []
# zero_count = 0
# aim = [[5,4,6,7,1,9,2,3,8],[9,2,1,8,3,4,6,5,7],[8,3,7,6,2,5,4,1,9],[7,1,8,4,6,3,9,2,5],[4,5,3,2,9,1,7,8,6],[6,9,2,5,8,7,1,4,3],[2,8,4,9,5,6,3,7,1],[3,6,5,1,7,2,8,9,4],[1,7,9,3,4,8,5,6,2]]
# for i in range(81):
#     if b[i] == 0:
#         zero_count += 1
#         c.append(aim[i // 9][i % 9])
# print(c)
# print(len(c))
# print(zero_count)
# idx = 0
# for i in range(len(a)):
#     if (i % 9 + 1) == c[idx]:

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

最后于 2021-12-14 20:04 被全盲法师编辑 ,原因: 去掉吐槽
收藏
免费 1
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//