CCF 201503-1 图像旋转(满分100)

#include<iostream>

using namespace std;

int a[1000][1000];

int main()
{
    
    
	int m, n;
	cin >> m >> n;
	for (int i = 0; i < m; i++)
		for (int j = 0; j < n; j++)
			cin >> a[i][j];
	cout << endl;
	// 矩阵的转换,注意下标
	for (int i = n - 1; i >= 0; i--) 
		for (int j = 0; j < m; j++) 
		{
    
    
			cout << a[j][i] << " ";
			if ((j + 1) % m == 0) cout << endl; // 达到输出要求
		}
		cout << endl;

	system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_27538633/article/details/105720951