Advertisement
AdelKhalilov

Untitled

Jan 25th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. if (w >= k) {
  2. if (c >= k) {
  3. out.println("YES");
  4. for (int i = 0; i < n; i++) {
  5. if (i % 2 == 0) {
  6. out.print('W');
  7. } else {
  8. out.print('C');
  9. }
  10. }
  11. } else {
  12. if (b >= k) {
  13. out.println("YES");
  14. for (int i = 0; i < n; i++) {
  15. if (i % 2 == 0) {
  16. out.print('W');
  17. } else {
  18. out.print('B');
  19. }
  20. }
  21. } else {
  22. if (n <= 2 * (c + b) + 1) {
  23. out.println("YES");
  24. for (int i = 0; i < n; i++) {
  25. if (i % 2 == 0) {
  26. out.print("W");
  27. } else {
  28. if (c > 0) {
  29. out.print("C");
  30. c--;
  31. } else {
  32. out.print("B");
  33. }
  34. }
  35. }
  36. } else {
  37. out.print("NO");
  38. }
  39. }
  40. }
  41. } else {
  42. if (c >= k) {
  43. if (b >= k) {
  44. out.println("YES");
  45. for (int i = 0; i < n; i++) {
  46. if (i % 2 == 0) {
  47. out.print('B');
  48. } else {
  49. out.print('C');
  50. }
  51. }
  52. } else {
  53. if (n <= 2 * (w + b) + 1) {
  54. out.println("YES");
  55. for (int i = 0; i < n; i++) {
  56. if (i % 2 == 0) {
  57. out.print("C");
  58. } else {
  59. if (w > 0) {
  60. out.print("W");
  61. w--;
  62. } else {
  63. out.print("B");
  64. }
  65. }
  66. }
  67. } else {
  68. out.print("NO");
  69. }
  70.  
  71. }
  72. } else {
  73. if (n <= 2 * (c + w) + 1) {
  74. out.println("YES");
  75. for (int i = 0; i < n; i++) {
  76. if (i % 2 == 0) {
  77. out.print("B");
  78. } else {
  79. if (c > 0) {
  80. out.print("C");
  81. c--;
  82. } else {
  83. out.print("W");
  84. }
  85. }
  86. }
  87. } else {
  88. out.print("NO");
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement