n
-by- n
Matrix A
=(a
i,j
)的永久变量定义为
在此S_n
表示的所有排列的集合[1, n]
。
作为一个例子(来自维基):
您的代码可以随意输入,并以任何合理的格式输出,但是请在答案中包括一个完整的示例,其中包括有关如何向代码提供输入的明确说明。为了使挑战更加有趣,矩阵可以包含复数。
输入矩阵始终为正方形,最多为6 x6。 您还需要能够处理具有永久性1的空矩阵。不需要处理空矩阵(这会引起过多的结果)。问题)。
例子
输入:
[[ 0.36697048+0.02459455j, 0.81148991+0.75269667j, 0.62568185+0.95950937j],
[ 0.67985923+0.11419187j, 0.50131790+0.13067928j, 0.10330161+0.83532727j],
[ 0.71085747+0.86199765j, 0.68902048+0.50886302j, 0.52729463+0.5974208j ]]
输出:
-1.7421952844303492+2.2476833142265793j
输入:
[[ 0.83702504+0.05801749j, 0.03912260+0.25027115j, 0.95507961+0.59109069j],
[ 0.07330546+0.8569899j , 0.47845015+0.45077079j, 0.80317410+0.5820795j ],
[ 0.38306447+0.76444045j, 0.54067092+0.90206306j, 0.40001631+0.43832931j]]
输出:
-1.972117936608412+1.6081325306004794j
输入:
[[ 0.61164611+0.42958732j, 0.69306292+0.94856925j,
0.43860930+0.04104116j, 0.92232338+0.32857505j,
0.40964318+0.59225476j, 0.69109847+0.32620144j],
[ 0.57851263+0.69458731j, 0.21746623+0.38778693j,
0.83334638+0.25805241j, 0.64855830+0.36137045j,
0.65890840+0.06557287j, 0.25411493+0.37812483j],
[ 0.11114704+0.44631335j, 0.32068031+0.52023283j,
0.43360984+0.87037973j, 0.42752697+0.75343656j,
0.23848512+0.96334466j, 0.28165516+0.13257001j],
[ 0.66386467+0.21002292j, 0.11781236+0.00967473j,
0.75491373+0.44880959j, 0.66749636+0.90076845j,
0.00939420+0.06484633j, 0.21316223+0.4538433j ],
[ 0.40175631+0.89340763j, 0.26849809+0.82500173j,
0.84124107+0.23030393j, 0.62689175+0.61870543j,
0.92430209+0.11914288j, 0.90655023+0.63096257j],
[ 0.85830178+0.16441943j, 0.91144755+0.49943801j,
0.51010550+0.60590678j, 0.51439995+0.37354955j,
0.79986742+0.87723514j, 0.43231194+0.54571625j]]
输出:
-22.92354821347135-90.74278997288275j
您可能不使用任何预先存在的函数来计算永久物。
[[]]
(有一行,空矩阵没有)还是[]
(没有深度2,矩阵有)?
[[]]
。