Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- if(n % 2 == 0)
- {
- for(int i = 0; i < n;i++)
- {
- if(i % 2 == 0)
- {
- bool flag = 0;
- for(int j = 0; j < n;j++)
- {
- if(flag == 0)
- {
- cout << "W";
- flag = !flag;
- }
- else
- {
- cout << "B";
- flag = !flag;
- }
- }
- cout << endl;
- }
- else
- {
- bool flag = 0;
- for(int j = 0; j < n;j++)
- {
- if(flag == 0)
- {
- cout << "B";
- flag = !flag;
- }
- else
- {
- cout << "W";
- flag = !flag;
- }
- }
- cout << endl;
- }
- }
- }
- else
- {
- for(int i = 0; i < n;i++)
- {
- if(i % 2 == 0)
- {
- bool flag = 0;
- for(int j = 0; j < n;j++)
- {
- if(flag == 0)
- {
- cout << "W";
- flag = !flag;
- }
- else
- {
- cout << "B";
- flag = !flag;
- }
- }
- cout << endl;
- }
- else
- {
- for(int j = 0; j < n;j++)
- {
- cout << "B";
- }
- cout << endl;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement