-
Notifications
You must be signed in to change notification settings - Fork 0
/
B.cpp
75 lines (74 loc) · 1.51 KB
/
B.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
fastio;
char ara[405][405];
int t,n,i,j,i1,j1,i2,j2,p;
cin>>t;
while(t--)
{
p=0;
cin>>n;
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
cin>>ara[i][j];
if(ara[i][j]=='*')
{
if(p==0)
{
i1=i;
j1=j;
p=1;
}
else
{
i2=i;
j2=j;
}
}
}
}
if(i1==i2)
{
if(i1==n-1)
{
ara[i1-1][j1]='*';
ara[i1-1][j2]='*';
}
else
{
ara[i1+1][j1]='*';
ara[i1+1][j2]='*';
}
}
else if(j1==j2)
{
if(j1==n-1)
{
ara[i1][j1-1]='*';
ara[i2][j1-1]='*';
}
else
{
ara[i1][j1+1]='*';
ara[i2][j1+1]='*';
}
}
else
{
ara[i1][j2]='*';
ara[i2][j1]='*';
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
cout<<ara[i][j];
cout<<"\n";
}
}
return 0;
}