Advertisement
Sim0o0na

Untitled

Apr 16th, 2018
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.33 KB | None | 0 0
  1. package test10_03;
  2.  
  3. import javax.xml.bind.SchemaOutputResolver;
  4. import java.util.Scanner;
  5.  
  6. public class PIN {
  7.     public static void main(String[] agrs) {
  8.         Scanner scanner = new Scanner(System.in);
  9.         int n = Integer.parseInt(scanner.nextLine());
  10.         int col = 6 * n + 10;
  11.         int rows = 2 * n + 2;
  12.  
  13.  
  14.         String firstRow = "/`"
  15.                 + repeatStr("P", 2 * n)
  16.                 + repeatStr(" ", n)
  17.                 + "/`I"
  18.                 + repeatStr(" ", n)
  19.                 + "/`N"
  20.                 + repeatStr(" ", 2 * n + 1)
  21.                 + "N";
  22.         System.out.println(firstRow);
  23.  
  24.         for (int i = 0; i < n - 1; i++) {
  25.  
  26.             String middleRow1 = "| P"
  27.                     + repeatStr(" ", 2 * n - 2)
  28.                     + "P"
  29.                     + repeatStr(" ", n)
  30.                     + "| I"
  31.                     + repeatStr(" ", n)
  32.                     + "| N"
  33.                     + repeatStr(" ", i)
  34.                     + "N"
  35.                     + repeatStr(" ", 2 * n - i)
  36.                     + "N";
  37.  
  38.             System.out.println(middleRow1);
  39.         }
  40.  
  41.         String middlePart2 = "| "
  42.                 + repeatStr("P", 2 * n)
  43.                 + repeatStr(" ", n)
  44.                 + "| I"
  45.                 + repeatStr(" ", n)
  46.                 + "| N"
  47.                 + repeatStr(" ", n - 1) + "N"
  48.                 + repeatStr(" ", n + 1) + "N";
  49.  
  50.         System.out.println(middlePart2);
  51.  
  52.         for (int i = 0; i < n; i++) {
  53.             String downPart = "| " + repeatStr("P", n / 2)
  54.                     + repeatStr(" ", 2 * n - n / 2 + n)
  55.                     + "| I"
  56.                     + repeatStr(" ", n)
  57.                     + "| N" + repeatStr(" ", n + i)
  58.                     + "N" + repeatStr(" ", n - i) + "N";
  59.  
  60.             System.out.println(downPart);
  61.         }
  62.  
  63.         String lastRow = "\\_" + repeatStr("P", n / 2)
  64.                 + repeatStr(" ", 2 * n - n / 2 + n)
  65.                 + "\\_I" + repeatStr(" ", n)
  66.                 + "\\_N" + repeatStr(" ", 2 * n) + "NN";
  67.  
  68.         System.out.println(lastRow);
  69.  
  70.  
  71.     }
  72.  
  73.     static String repeatStr(String str, int count) {
  74.         String text = "";
  75.         {
  76.             for (int j = 0; j < count; j++) {
  77.                 text = text + str;
  78.             }
  79.  
  80.         }
  81.         return text;
  82.     }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement