-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathri.cpp
44 lines (44 loc) · 772 Bytes
/
ri.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int a[n][n],m[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin>>a[i][j];
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if((i+j)!=n-1)
{
m[i][j]=a[n-j-1][n-i-1];
}
else
m[i][j]=a[i][j];
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n/2;j++)
{
int t=m[i][j];
m[i][j]=m[i][n-j-1];
m[i][n-j-1]=t;
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<m[i][j]<<" ";
}
cout<<endl;
}
return 0;
}