- #include< bits/stdc++.h >
- using namespace std;
- int main(){
- int n, m, b = 0, w = 0;
- cin >> n >> m;
- char data[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- cin >> data[i][j];
- }
- }
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- if(data[i][j] == '.') {
- if((i+j) % 2) cout << 'W';
- else cout << 'B';
- }else cout << data[i][j];
- }
- cout << endl;
- }
- return 0;
- }
Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts
Monday, September 16, 2019
Codeforce A. DZY Loves Chessboard
Codeforce A. Yaroslav and Permutations
- #include< iostream >
- using namespace std;
- int main() {
- int n, x;
- cin >> n;
- int ar[10001] = {0};
- for(int i = 0; i < n; i++) {
- cin >> x;
- ar[x]++;
- if(ar[x] > (n+1)/2) return cout << "NO\n", 0;
- }
- cout << "YES\n";
- return 0;
- }
Codeforce A. Collecting Beats is Fun
- #include< bits/stdc++.h >
- using namespace std;
- int main(){
- int k;
- char a;
- cin >> k;
- int ar[10] = {0};
- for(int i = 0; i < 16; i++){
- cin >> a;
- ar[a]++;
- }
- for(int i = 1; i < 10; i++)
- if(ar[i+'0'] > 2*k) return cout << "NO\n", 0;
- cout << "YES\n";
- return 0;
- }
Codeforce A. Levko and Table
- #include< iostream >
- using namespace std;
- int main()
- {
- int n, k;
- cin >> n >> k;
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- cout << ((i == j)? k : 0 ) << " ";
- }
- cout << endl;
- }
- return 0;
- }
Subscribe to:
Posts (Atom)