0%

Problem 913


Problem 913


Row-major vs Column-major

The numbers from 1 to 12 can be arranged into a 3×4 matrix in either row-major or column-major order:
R=(123456789101112),C=(147102581136912)
By swapping two entries at a time, at least 8 swaps are needed to transform R to C.

Let S(n,m) be the minimal number of swaps needed to transform an n×m matrix of 1 to nm from row-major order to column-major order. Thus S(3,4)=8.

You are given that the sum of S(n,m) for 2nm100 is 12578833.

Find the sum of S(n4,m4) for 2nm100.


行优先与列优先

112这些数可以按行优先列优先的顺序填入一个3×4矩阵中:
R=(123456789101112),C=(147102581136912)
每次交换两个元素,至少需要8次交换才能将R转换为C

S(n,m)为将一个包含1nmn×m矩阵从行优先顺序转换为列优先顺序所需的最少交换次数,因此S(3,4)=8

已知对于所有2nm100S(n,m)之和为12578833

求对于所有2nm100S(n4,m4)之和。


Gitalking ...