File tree Expand file tree Collapse file tree 3 files changed +80
-0
lines changed Expand file tree Collapse file tree 3 files changed +80
-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
+ #define long long long int
6
+
7
+ int main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (NULL );
10
+
11
+ int H, W;
12
+ cin >> H >> W;
13
+
14
+ vector<string> grid (H);
15
+ for (int i = 0 ; i < H; i++)
16
+ cin >> grid[i];
17
+
18
+ for (int i = 0 ; i < H; i++)
19
+ for (int j = 0 ; j < W; j++)
20
+ if (grid[i][j] == ' .' )
21
+ for (char color = ' 1' ; color <= ' 5' ; color++) {
22
+ if (i && grid[i - 1 ][j] == color) continue ;
23
+ if (i + 1 < H && grid[i + 1 ][j] == color) continue ;
24
+ if (j && grid[i][j - 1 ] == color) continue ;
25
+ if (j + 1 < W && grid[i][j + 1 ] == color) continue ;
26
+
27
+ grid[i][j] = color;
28
+ break ;
29
+ }
30
+
31
+ for (int i = 0 ; i < H; i++)
32
+ cout << grid[i] << " \n " ;
33
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ #define long long long int
6
+
7
+ int main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (NULL );
10
+
11
+ int A, B;
12
+ cin >> A >> B;
13
+
14
+ string ans = to_string ((10 * B) / 2 );
15
+ ans += to_string (A);
16
+
17
+ cout << ans << " \n " ;
18
+ }
Original file line number Diff line number Diff line change
1
+ #include < bits/stdc++.h>
2
+
3
+ using namespace std ;
4
+
5
+ #define long long long int
6
+
7
+ int main () {
8
+ ios_base::sync_with_stdio (false );
9
+ cin.tie (NULL );
10
+
11
+ int N; cin >> N;
12
+
13
+ int x = 0 ;
14
+ vector<int > A (N);
15
+
16
+ for (int i = 0 ; i < N; i++) {
17
+ cin >> A[i];
18
+ x ^= A[i];
19
+ }
20
+
21
+ if (N & 1 ) cout << " Win\n " ;
22
+ else {
23
+ bool win = false ;
24
+ for (int i = 0 ; i < N && !win; i++)
25
+ if (A[i] == x) win = true ;
26
+
27
+ cout << (win ? " Win" : " Lose" ) << " \n " ;
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments