formygloryandpeacefulday  

include

using namespace std;

define max 20

int main()
{
int a[max][max];
int n;
cin >> n;
int temp;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
a[i][j] = n * i + j+1;
cout << a[i][j] << " ";
if (j == n-1)
{
cout << '\n';
}
}
}
cout << '\n';

for (int i = 0; i < n; i++)
{
	for (int j = 0; j < n; j++)
	{
		cout << a[j][i] << ' ';
		if (j == n - 1)
		{
			cout << '\n';
		}
	}
}
return 0;

}

posted on 2024-11-18 22:14  残夏便是结局  阅读(16)  评论(0)    收藏  举报