Advertisement
tenachev

Sheriff

Apr 19th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Sheriff {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(scanner.nextLine());
  8.  
  9.         String firstLine = repeatStr(".", (n * 3 - 1) / 2) + "x" + repeatStr(".", (n * 3 - 1) / 2);
  10.         System.out.println(firstLine);
  11.         String secondLine = repeatStr(".", (n * 3 - 3) / 2) + "/x\\" + repeatStr(".", (n * 3 - 3) / 2);
  12.         System.out.println(secondLine);
  13.         String tirthLine = repeatStr(".", (n * 3 - 3) / 2) + "x|x" + repeatStr(".", (n * 3 - 3) / 2);
  14.         System.out.println(tirthLine);
  15.         for (int i = 0; i < (n - 1) / 2; i++) {
  16.             String cycle = repeatStr(".", (n * 3 - 1) / 2 - n - i) + repeatStr("x", n + i)
  17.                     + "|"
  18.                     + repeatStr("x", n + i)
  19.                     + repeatStr(".", (n * 3 - 1) / 2 - n - i);
  20.             System.out.println(cycle);
  21.         }
  22.         String middle = repeatStr("x", (n * 3 - 1) / 2) + "|" + repeatStr("x", (n * 3 - 1) / 2);
  23.         System.out.println(middle);
  24.  
  25.         for (int i = 0; i < (n - 1) / 2; i++) {
  26.             String cycleReverse = repeatStr(".", 1 + i) + repeatStr("x", (n * 3 - 3) / 2 - i)
  27.                     + "|"
  28.                     + repeatStr("x", (n * 3 - 3) / 2 - i)
  29.                     + repeatStr(".", 1 + i);
  30.             System.out.println(cycleReverse);
  31.         }
  32.         System.out.println(secondLine);
  33.         String secondLineMirrored = repeatStr(".", (n * 3 - 3) / 2) + "\\x/" + repeatStr(".", (n * 3 - 3) / 2);
  34.         System.out.println(secondLineMirrored);
  35.         for (int i = 0; i < (n - 1) / 2; i++) {
  36.             String cycle = repeatStr(".", (n * 3 - 1) / 2 - n - i) + repeatStr("x", n + i)
  37.                     + "|"
  38.                     + repeatStr("x", n + i)
  39.                     + repeatStr(".", (n * 3 - 1) / 2 - n - i);
  40.             System.out.println(cycle);
  41.         }
  42.  
  43.         System.out.println(middle);
  44.  
  45.         for (int i = 0; i < (n - 1) / 2; i++) {
  46.             String cycleReverse = repeatStr(".", 1 + i) + repeatStr("x", (n * 3 - 3) / 2 - i)
  47.                     + "|"
  48.                     + repeatStr("x", (n * 3 - 3) / 2 - i)
  49.                     + repeatStr(".", 1 + i);
  50.             System.out.println(cycleReverse);
  51.         }
  52.         System.out.println(tirthLine);
  53.         System.out.println(secondLineMirrored);
  54.         System.out.println(firstLine);
  55.     }
  56.  
  57.     static String repeatStr(String strToRepeat, int count) {
  58.         String text = "";
  59.  
  60.         for (int i = 0; i < count; i++) {
  61.             text = text + strToRepeat;
  62.         }
  63.         return text;
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement