-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJ02101
32 lines (30 loc) · 895 Bytes
/
J02101
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
package test;
import java.util.*;
public class J02101 {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- >0){
int n = sc.nextInt();
int a[][] = new int[103][103];
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
a[i][j] = sc.nextInt();
}
}
for(int i = 1; i <= n; i++){
if(i%2 == 1){
for(int j = 1; j <= n; j++){
System.out.printf("%d ",a[i][j]);
}
}
else{
for(int j = n; j >= 1; j--){
System.out.printf("%d ",a[i][j]);
}
}
}
System.out.println("");
}
}
}