Advertisement
Guest User

hgfd

a guest
Sep 19th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. cin >> n;
  7. if(n % 2 == 0)
  8. {
  9. for(int i = 0; i < n;i++)
  10. {
  11. if(i % 2 == 0)
  12. {
  13. bool flag = 0;
  14. for(int j = 0; j < n;j++)
  15. {
  16. if(flag == 0)
  17. {
  18. cout << "W";
  19. flag = !flag;
  20. }
  21. else
  22. {
  23. cout << "B";
  24. flag = !flag;
  25. }
  26. }
  27. cout << endl;
  28.  
  29. }
  30. else
  31. {
  32. bool flag = 0;
  33. for(int j = 0; j < n;j++)
  34. {
  35. if(flag == 0)
  36. {
  37. cout << "B";
  38. flag = !flag;
  39. }
  40. else
  41. {
  42. cout << "W";
  43. flag = !flag;
  44. }
  45. }
  46. cout << endl;
  47. }
  48. }
  49. }
  50. else
  51. {
  52. for(int i = 0; i < n;i++)
  53. {
  54. if(i % 2 == 0)
  55. {
  56. bool flag = 0;
  57. for(int j = 0; j < n;j++)
  58. {
  59. if(flag == 0)
  60. {
  61. cout << "W";
  62. flag = !flag;
  63. }
  64. else
  65. {
  66. cout << "B";
  67. flag = !flag;
  68. }
  69. }
  70. cout << endl;
  71.  
  72. }
  73. else
  74. {
  75. for(int j = 0; j < n;j++)
  76. {
  77. cout << "B";
  78. }
  79. cout << endl;
  80. }
  81. }
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement