-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmirror.java
54 lines (46 loc) · 1.25 KB
/
mirror.java
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
45
46
47
48
49
50
51
52
53
54
import java.util.*;
public class mirror
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int times = scan.nextInt();
for(int skrt = 0; skrt < times; skrt++)
{
int r = scan.nextInt();
int c = scan.nextInt();
char[][] img = new char[r][c];
scan.nextLine();
for(int i=0; i < r; i++)
{
img[i] = scan.nextLine().toCharArray();
}
char[][] sides = new char[r][c];
char[][] upside = new char[r][c];
for(int rr = 0; rr < r; rr++)
{
for(int cc = 0; cc < c; cc++)
{
sides[rr][cc] = img[r-rr-1][cc];
}
}
for(int rr = 0; rr < r; rr++)
{
for(int cc = 0; cc < c; cc++)
{
upside[rr][cc] = sides[rr][c-cc-1];
}
}
System.out.println("Test" + " " + (skrt+1));
for(int rr = 0; rr < r; rr++)
{
for(int cc = 0; cc < c; cc++)
{
System.out.print(upside[rr][cc]);
}
System.out.println();
}
}
scan.close();
}
}