View Code of Problem 45

#include<cstdio>
#include<vector>
using namespace std;
int main(){
	int n,a;
	scanf("%d",&n);
	vector<vector<int> > vt(n+1);
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			scanf("%d",&a);
			vt[i].push_back(a);
		}
	}
	for(int j=0;j<n;j++){
		for(int i=0;i<n;i++){
			if(i!=n-1)	printf("%d ",vt[i][j]);
			else printf("%d\n",vt[i][j]);
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 45