Advertisement
Sim0o0na

Untitled

Apr 16th, 2018
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.32 KB | None | 0 0
  1. package test14april2018;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Task5 {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner sc = new Scanner(System.in);
  9.  
  10.         int n = sc.nextInt();
  11.         char quote = '\'';
  12.  
  13.         int width = 8 * n + 2;
  14.  
  15.         System.out.println("'&$" + repeat(quote, width - 3));
  16.  
  17.         for (int i = 0; i < n - 1; i++) {
  18.             System.out.println(repeat(quote, 2 + i) + "\\" + repeat(quote, width - 3 - i));
  19.         }
  20.  
  21.         for (int i = 0; i < width - 1; i++) {
  22.             if (i % 2 == 0) {
  23.                 System.out.print("^");
  24.             } else {
  25.                 System.out.print("*");
  26.             }
  27.         }
  28.         System.out.println(quote);
  29.  
  30.         for (int i = 0; i < n * 4 - 1; i++) {
  31.             if (i < n - 1) {
  32.                 System.out.println(repeat(quote, i)
  33.                                    + "\\\\"
  34.                                    + repeat(" ", n)
  35.                                    + "\\"
  36.                                    + repeat(" ", width - 6 - i * 2 - n)
  37.                                    + "//"
  38.                                    + repeat(quote, i + 1));
  39.             } else if (i == n - 1) {
  40.                 System.out.println(repeat(quote, i)
  41.                                    + "\\"
  42.                                    + repeat("~", width - 3 - i * 2)
  43.                                    + "/"
  44.                                    + repeat(quote, i + 1));
  45.             } else if (i == n * 2 - 2) {
  46.                 System.out
  47.                     .println(repeat(quote, i) + "\\" + repeat("_", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
  48.             } else if (i == n * 2 - 1) {
  49.                 System.out
  50.                     .println(repeat(quote, i) + "\\" + repeat(".", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
  51.             } else if (i == n * 4 - 2) {
  52.                 System.out
  53.                     .println(repeat(quote, i) + "\\" + repeat("_", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
  54.             } else {
  55.                 System.out
  56.                     .println(repeat(quote, i) + "\\" + repeat(" ", width - 3 - i * 2) + "/" + repeat(quote, i + 1));
  57.             }
  58.         }
  59.  
  60.         for (int i = 0; i < n * 2 + 1; i++) {
  61.             System.out.println(repeat(quote, width / 2 - 2) + "|||" + repeat(quote, width / 2 - 1));
  62.         }
  63.  
  64.         System.out.println(repeat('_', width - 1) + quote);
  65.         System.out.println(quote + repeat('-', width - 3) + quote + quote);
  66.  
  67.         sc.close();
  68.     }
  69.  
  70.     private static String repeat(char c, int n) {
  71.         return repeat("" + c, n);
  72.     }
  73.  
  74.     private static String repeat(String c, int n) {
  75.         StringBuilder result = new StringBuilder();
  76.  
  77.         for (int i = 0; i < n; i++) {
  78.             result.append(c);
  79.         }
  80.  
  81.         return result.toString();
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement