杭州思拓网站建设,开发公司空置房拨款合同,网页qq注册新账号免费,wordpress 下一篇样式背景需求#xff1a;
测试5宫格有多少种不重复的基础模板#xff08;只测试所有的25数字一组有多少个#xff09; # 测试11*11格#xff0c;2*2一共4套3*3 宫格目的#xff1a;数独14 5宫格有不同的基础模板
作者#xff1a;阿夏
时间#xff1a;2024年01月04日 13:…
背景需求
测试5宫格有多少种不重复的基础模板只测试所有的25数字一组有多少个
# 测试11*11格2*2一共4套3*3 宫格目的数独14 5宫格有不同的基础模板
作者阿夏
时间2024年01月04日 13:35import random
from win32com.client import constants,gencache
from win32com.client.gencache import EnsureDispatch
from win32com.client import constants # 导入枚举常数模块
import os,timeimport docx
from docx import Document
from docx.shared import Pt
from docx.shared import RGBColor
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
from docx.oxml.ns import qnfrom docxtpl import DocxTemplate
import pandas as pd
from docx2pdf import convert
from docx.shared import RGBColor# 生成题库
import random
import math
from itertools import permutations# numint(input(生成几份\n))
# 制作单元格# 几宫格
hsall5
# int(input(3宫格数独3\n))
hshsallprint(------第2步制作3宫格的12套题的内容-------)# 制作3宫格的12套题目没有空格只有基础模板
lst[]
for b in range(1,hs1):lst.append(b)
print(lst)permutations_list list(permutations(lst))
numbers [list(permutation) for permutation in permutations_list]
print(numbers)
# [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
# 6种组合
# 互相组合成3组
import itertools# 计算排列数量并生成所有可能的排列
combinations2 list(itertools.permutations(numbers, hs))# 输出排列数量
# print(len(combinations2))
# 120# # 把所有数字都提取成元素
ll[]
for o1 in combinations2:for o2 in o1:for o3 in o2:ll.append(o3)
# print(ll)
# print(len(ll))
# 1080vhs*hs
# 16个数字抽取一组
f[]
for i in range(int(len(ll)/v)):f.append(ll[i*v:i*vv])
# print(f)
print(len(f))
#120条# # # # 遍历表格把0、5、10相同的内容删除,横向的数字1234都正确了现在只要排除竖向不对的# P[]
# zz[]
# u[]
# for k in f: # if int(k[0])!int(k[4])and \
# int(k[0])!int(k[8])and
# int(k[0])!int(k[12]) and int(k[4])!int(k[8]) and int(k[4])!int(k[12])and int(k[8])!int(k[12]) and \
# int(k[0])int(k[4])int(k[8])int(k[12])10 and \
# int(k[1])!int(k[5])and int(k[1])!int(k[9])and int(k[1])!int(k[13]) and int(k[5])!int(k[9]) and int(k[5])!int(k[13])and int(k[9])!int(k[13]) and int(k[1])int(k[5])int(k[9])int(k[13])10 and \
# int(k[2])!int(k[6])and int(k[2])!int(k[10])and int(k[2])!int(k[14]) and int(k[6])!int(k[10]) and int(k[6])!int(k[14])and int(k[10])!int(k[14]) and int(k[2])int(k[6])int(k[10])int(k[14])10 and\
# int(k[3])!int(k[7])and int(k[3])!int(k[11])and int(k[3])!int(k[15]) and int(k[7])!int(k[11]) and int(k[7])!int(k[15])and int(k[11])!int(k[15]) and int(k[3])int(k[7])int(k[11])int(k[15])10:# zz.append(k)
# print(zz)
# print(不重复题目数量{}.format(len(zz))) 运行了90分钟结果报错 MemoryError显示内存不够计算 显示内存不够计算 这篇文章有破解的思路逐一尝试
python中memoryerror_mob649e8164659f的技术博客_51CTO博客python中memoryerror#Python中的MemoryError错误在编写Python程序时您可能会遇到MemoryError错误。这个错误表示您的程序尝试使用超出可用内存的资源。本文将介绍MemoryError错误的原因、如何处理它以及一些预防内存错误的最佳实践。##1.什么是MemoryErrorMemoryError是Python解释器在尝试分配内存时抛出的异常。当您的程序需要存储https://blog.51cto.com/u_16175500/6892741