Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test10_03;
- import javax.xml.bind.SchemaOutputResolver;
- import java.util.Scanner;
- public class PIN {
- public static void main(String[] agrs) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int col = 6 * n + 10;
- int rows = 2 * n + 2;
- String firstRow = "/`"
- + repeatStr("P", 2 * n)
- + repeatStr(" ", n)
- + "/`I"
- + repeatStr(" ", n)
- + "/`N"
- + repeatStr(" ", 2 * n + 1)
- + "N";
- System.out.println(firstRow);
- for (int i = 0; i < n - 1; i++) {
- String middleRow1 = "| P"
- + repeatStr(" ", 2 * n - 2)
- + "P"
- + repeatStr(" ", n)
- + "| I"
- + repeatStr(" ", n)
- + "| N"
- + repeatStr(" ", i)
- + "N"
- + repeatStr(" ", 2 * n - i)
- + "N";
- System.out.println(middleRow1);
- }
- String middlePart2 = "| "
- + repeatStr("P", 2 * n)
- + repeatStr(" ", n)
- + "| I"
- + repeatStr(" ", n)
- + "| N"
- + repeatStr(" ", n - 1) + "N"
- + repeatStr(" ", n + 1) + "N";
- System.out.println(middlePart2);
- for (int i = 0; i < n; i++) {
- String downPart = "| " + repeatStr("P", n / 2)
- + repeatStr(" ", 2 * n - n / 2 + n)
- + "| I"
- + repeatStr(" ", n)
- + "| N" + repeatStr(" ", n + i)
- + "N" + repeatStr(" ", n - i) + "N";
- System.out.println(downPart);
- }
- String lastRow = "\\_" + repeatStr("P", n / 2)
- + repeatStr(" ", 2 * n - n / 2 + n)
- + "\\_I" + repeatStr(" ", n)
- + "\\_N" + repeatStr(" ", 2 * n) + "NN";
- System.out.println(lastRow);
- }
- static String repeatStr(String str, int count) {
- String text = "";
- {
- for (int j = 0; j < count; j++) {
- text = text + str;
- }
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement