Advertisement
Guest User

Untitled

a guest
Jul 9th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. package ExamTime;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6.  
  7. public class Lamp {
  8. public static void main(String[] args) throws IOException {
  9. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  10. int n = Integer.parseInt(reader.readLine());
  11. int slashesCount = (2 * n + 8) / 2;
  12. int weidth = (4 * n + 11);
  13. int dots = (2 * n + 8) / 2;
  14.  
  15. System.out.print(repeat(".", slashesCount));
  16. System.out.print(repeat("_", slashesCount - 4));
  17. System.out.print("/|\\");
  18. System.out.print(repeat("_", slashesCount - 4));
  19. System.out.println(repeat(".", slashesCount));
  20.  
  21.  
  22. System.out.print(repeat(".", slashesCount));
  23. System.out.print("/");
  24. System.out.print(repeat("-", slashesCount + n - 3));
  25. System.out.print("\\");
  26. System.out.println(repeat(".", slashesCount));
  27. slashesCount--;
  28.  
  29. for (int i = 0; i < (n - 2); i++) {
  30. System.out.print(repeat(".", slashesCount));
  31. System.out.print("/");
  32. System.out.print(repeat(".", dots + i * 2 + n - 1));
  33. System.out.print("\\");
  34. System.out.println(repeat(".", slashesCount));
  35. slashesCount--;
  36.  
  37. }
  38. dots = (2 * n + 8 - 9);
  39. System.out.print(repeat(".", slashesCount));
  40. System.out.print("/");
  41. System.out.print(repeat("_", dots * 2 + 1));
  42. System.out.print("\\");
  43. System.out.println(repeat(".", slashesCount));
  44. slashesCount--;
  45.  
  46.  
  47. for (int i = 0; i <= (n - 2) / 2; i++) {
  48. System.out.print(repeat(".", slashesCount));
  49. System.out.print("/");
  50. System.out.print(repeat(".", dots + i * 2 + n + n + 2));
  51. System.out.print("\\");
  52. System.out.println(repeat(".", slashesCount));
  53. slashesCount--;
  54.  
  55. }
  56. System.out.print("./");
  57. System.out.print(repeat("_", weidth - 4));
  58. System.out.println("\\.");
  59.  
  60. System.out.print("/");
  61. System.out.print(repeat("_", weidth - 2));
  62. System.out.println("\\");
  63.  
  64.  
  65.  
  66. for (int i = 0; i < n; i++) {
  67.  
  68. System.out.print(repeat(".", weidth / 2 - 1));
  69. System.out.print("|$|");
  70. System.out.println(repeat(".", weidth / 2 - 1));
  71. }
  72.  
  73.  
  74. System.out.print("....");
  75. System.out.print(repeat("_", weidth / 2 - 5));
  76. System.out.print("|$|");
  77. System.out.print(repeat("_", weidth / 2 - 5));
  78. System.out.println("....");
  79.  
  80. System.out.print("...");
  81. System.out.print("/");
  82. System.out.print(repeat("_", weidth / 2 + n + n - 2));
  83. System.out.print("\\");
  84. System.out.print("...");
  85.  
  86. }
  87.  
  88.  
  89.  
  90. private static String repeat (String symbol, int count){
  91. StringBuilder builder = new StringBuilder();
  92. for (int i = 0; i < count; i++) {
  93. builder.append(symbol);
  94. }
  95. return builder.toString();
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement