Advertisement
Guest User

dumb

a guest
Mar 30th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14.  
  15. int height = n;
  16. int width = n * 3;
  17.  
  18. int dumpTop = ((n + 1) / 2);
  19.  
  20. printTop(n, width, (int)Math.Floor(n / 2f));
  21. printMiddle(n, width, (int)Math.Floor(n / 2f) + 1);
  22. }
  23.  
  24. private static void printMiddle(int n, int width, int height)
  25. {
  26. int dumpTopWidth = ((n + 1) / 2);
  27. int leftStart = 0;
  28. int leftEnd = n - 1;
  29. int rightStart = (leftEnd + n) + 1;
  30. int rightEnd = width - 1;
  31. for (int i = 0; i < height; i++)
  32. {
  33. for (int b = 0; b < width; b++)
  34. {
  35. if (i == 0)
  36. {
  37. if (b == leftStart || b == leftEnd || b == rightStart || b == rightEnd)
  38. {
  39. Console.Write("&");
  40. }
  41. else if ((b > leftStart && b < leftEnd) || (b > rightStart && b < rightEnd))
  42. {
  43. Console.Write("*");
  44. }
  45. else
  46. {
  47. Console.Write("=");
  48. }
  49. }
  50. else if (i == height - 1)
  51. {
  52. if ((b >= leftStart && b <= leftEnd) || (b >= rightStart && b <= rightEnd))
  53. {
  54. Console.Write("&");
  55. }
  56. else
  57. {
  58. Console.Write(".");
  59. }
  60. }
  61. else
  62. {
  63. if (b == leftStart || b == leftEnd || b == rightStart || b == rightEnd)
  64. {
  65. Console.Write("&");
  66. }
  67. else if ((b > leftStart && b < leftEnd) || (b > rightStart && b < rightEnd))
  68. {
  69. Console.Write("*");
  70. }
  71. else
  72. {
  73. Console.Write(".");
  74. }
  75. }
  76. }
  77. Console.WriteLine();
  78. leftStart++;
  79. rightEnd--;
  80. }
  81. }
  82.  
  83. private static void printTop(int n, int width, int height)
  84. {
  85. int dumpTopWidth = ((n + 1) / 2);
  86. int leftEnd = n - 1;
  87. int leftStart = n - dumpTopWidth;
  88. int rightStart = (leftEnd + n) + 1;
  89. int rightEnd = (rightStart + dumpTopWidth) - 1;
  90. for (int i = 0; i < height; i++)
  91. {
  92. for (int b = 0; b < width; b++)
  93. {
  94. if (i == 0 || i == width - 1)
  95. {
  96. if ((b >= leftStart && b <= leftEnd) || (b >= rightStart && b <= rightEnd))
  97. {
  98. Console.Write("&");
  99. }
  100. else
  101. {
  102. Console.Write(".");
  103. }
  104. }
  105. else
  106. {
  107. if (b == leftStart || b == leftEnd || b == rightStart || b == rightEnd)
  108. {
  109. Console.Write("&");
  110. }
  111. else if ((b > leftStart && b < leftEnd) || (b > rightStart && b < rightEnd))
  112. {
  113. Console.Write("*");
  114. }
  115. else
  116. {
  117. Console.Write(".");
  118. }
  119. }
  120. }
  121. Console.WriteLine();
  122. leftStart--;
  123. rightEnd++;
  124. }
  125. }
  126. }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement