File tree 4 files changed +130
-0
lines changed
4 files changed +130
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ int main ()
6
+ {
7
+ int n, i, j;
8
+ cin>>n;
9
+ char ch[n][n];
10
+ for (i=0 ; i<n; i++)
11
+ {
12
+ for (j=0 ; j<n; j++)
13
+ cin>>ch[i][j];
14
+ }
15
+
16
+ for (i=0 ; i<n; i++)
17
+ {
18
+ for (j=0 ; j<n; j++)
19
+ {
20
+ if ((i>=1 ) && (i<(n-1 )) && (j>=1 ) && (j<(n-1 )))
21
+ {
22
+ if ((ch[i-1 ][j]<ch[i][j]) && (ch[i+1 ][j]<ch[i][j]) && (ch[i][j-1 ]<ch[i][j]) && (ch[i][j+1 ]<ch[i][j]))
23
+
24
+ ch[i][j] = ' X' ;
25
+ }
26
+ }
27
+ }
28
+
29
+ for (i=0 ; i<n; i++)
30
+ {
31
+ for (j=0 ; j<n; j++)
32
+ cout<<ch[i][j];
33
+ cout<<endl;
34
+ }
35
+ return 0 ;
36
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ int main ()
6
+ {
7
+ int n, i, level=0 , c=0 ;
8
+ cin>>n;
9
+ char ch[n];
10
+ cin>>ch;
11
+ for (i=0 ; i<n; i++)
12
+ {
13
+ if (ch[i]==' D' )
14
+ level = level - 1 ;
15
+ else
16
+ {
17
+ level = level + 1 ;
18
+ if (level==0 )
19
+ c++;
20
+ }
21
+ }
22
+ cout<<c;
23
+ return 0 ;
24
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+ using namespace std ;
3
+
4
+ int main ()
5
+ {
6
+ int n, i, j;
7
+ cin>>n;
8
+ for (i=1 ; i<=n; i++)
9
+ {
10
+ for (j=1 ; j<=(n-i); j++)
11
+ {
12
+ cout<<" " ;
13
+ }
14
+ for (int a =0 ; a<i;a++)
15
+ {
16
+ cout<<" #" ;
17
+ }
18
+ cout<<endl;
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ int main ()
6
+ {
7
+ char ch[10 ], i;
8
+ cin>>ch;
9
+ if (ch[8 ]==' A' )
10
+ {
11
+ if (ch[0 ]==' 1' && ch[1 ]==' 2' )
12
+ {
13
+ ch[0 ]=' 0' ;
14
+ ch[1 ]=' 0' ;
15
+ }
16
+
17
+ }
18
+ else
19
+ {
20
+ if (ch[0 ]==' 0' && ch[1 ]<=' 7' )
21
+ {
22
+ ch[0 ]=' 1' ;
23
+ ch[1 ]= ch[1 ] + 2 ;
24
+ }
25
+ else if (ch[0 ]==' 0' && ch[1 ]==' 8' )
26
+ {
27
+ ch[0 ]=' 2' ;
28
+ ch[1 ]=' 0' ;
29
+ }
30
+ else if (ch[0 ]==' 0' && ch[1 ]==' 9' )
31
+ {
32
+ ch[0 ]=' 2' ;
33
+ ch[1 ]=' 1' ;
34
+ }
35
+ else if (ch[0 ]==' 1' && ch[1 ]==' 0' )
36
+ {
37
+ ch[0 ]=' 2' ;
38
+ ch[1 ] = ' 2' ;
39
+ }
40
+ else if (ch[0 ]==' 1' && ch[1 ]==' 1' )
41
+ {
42
+ ch[0 ]=' 2' ;
43
+ ch[1 ] = ' 3' ;
44
+ }
45
+
46
+ }
47
+ for (i=0 ; i<8 ; i++)
48
+ cout<<ch[i];
49
+ return 0 ;
50
+ }
You can’t perform that action at this time.
0 commit comments