Advertisement
desislava_topuzakova

05.Fallen In Love

Mar 9th, 2018
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class FallenInLove {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8.  
  9. int counter = 0;
  10. int counter1 = 0;
  11.  
  12. System.out.print("##");
  13. System.out.print(repeatStr(".", 2 * n));
  14. System.out.print("##");
  15. System.out.print(repeatStr(".", 2 * n));
  16. System.out.println("##");
  17.  
  18. for (int i = 1; i <= n - 1; i++) {
  19. System.out.print("#");
  20. System.out.print(repeatStr("~", i));
  21. System.out.print("#");
  22. System.out.print(repeatStr(".", 2 * n - 2 - counter));
  23. System.out.print("#");
  24. System.out.print(repeatStr(".", 2 + counter));
  25. System.out.print("#");
  26. System.out.print(repeatStr(".", 2 * n - 2 - counter));
  27. System.out.print("#");
  28. System.out.print(repeatStr("~", i));
  29. System.out.println("#");
  30. counter += 2;
  31. }
  32.  
  33. System.out.print(".");
  34. System.out.print("#");
  35. System.out.print(repeatStr("~", n));
  36. System.out.print("#");
  37. System.out.print(repeatStr(".", 2 * n));
  38. System.out.print("#");
  39. System.out.print(repeatStr("~", n));
  40. System.out.print("#");
  41. System.out.println(".");
  42.  
  43. for (int j = 0; j < n - 1; j++) {
  44. System.out.print(repeatStr(".", 3 + counter1));
  45. System.out.print("#");
  46. System.out.print(repeatStr("~", n - 1 - j));
  47. System.out.print("#");
  48. System.out.print(repeatStr(".", 2 * n - 2 - counter1));
  49. System.out.print("#");
  50. System.out.print(repeatStr("~", n - 1 - j));
  51. System.out.print("#");
  52. System.out.println(repeatStr(".", 3 + counter1));
  53. counter1 += 2;
  54. }
  55. System.out.print(repeatStr(".", 2 * n + 1));
  56. System.out.print(repeatStr("#", 4));
  57. System.out.println(repeatStr(".", 2 * n + 1));
  58. for (int m = 0; m < n; m++) {
  59. System.out.print(repeatStr(".", 2 * n + 2));
  60. System.out.print("##");
  61. System.out.println(repeatStr(".", 2 * n + 2));
  62.  
  63. }
  64.  
  65.  
  66. }
  67.  
  68. static String repeatStr(String str, int count) {
  69. String text = "";
  70. {
  71. for (int i = 0; i < count; i++) {
  72. text = text + str;
  73. }
  74. }
  75. return text;
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement