1 /*
2 4. 在N行N列的数阵中, 数K(1〈=K〈=N)在每行和每列中出现且仅
3 出现一次,这样的数阵叫N阶拉丁方阵。例如下图就是一个五阶拉丁方阵。
4 编一程序,从键盘输入N值后,打印出所有不同的N阶拉丁方阵,并统计个数。
5
6 1 2 3 4 5
7 2 3 4 5 1
8 3 4 5 1 2
9 4 5 1 2 3
10 5 1 2 3 4
11 */
12 #include <iostream>
13 #include <cmath>
14
15 using namespace std;
16
17 int N = 3;
18
19 void main()
20 {
21 int n_temp;
22 // cout << "input the value for N:";
23 // cin >> n_temp;
24 // cout << '\n';
25 int matrix[3][3];
26 int row[3];
27 int col[3];
28 int numOfMatrix = 0;
29 int currentItem = 0;
30 for (int k=0; k < N; k++)
31 {
32 matrix[0][0] = k+1;
33 row
34 for (int i = 0; i < N; i++)
35 {
36 for (int j = 0; j < N; j++)
37 {
38 if ( i == j == 0 )
39 {
40 continue;
41 }
42
43
44 }
45 }
46 }
47 }