Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Exam10thMarch;
- import java.util.Scanner;
- public class Sword {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int width = 2 * n + 1;
- //first line
- System.out.println(repeatStr("#", n - 1) + "/^\\" + repeatStr("#", n - 1));
- //first part
- for (int i = 0; i < n / 2; i++) {
- String hashtags = repeatStr("#", n - 2 - i);
- String spaces = repeatStr(" ", 3 + 2 * i);
- System.out.println(hashtags + "." + spaces + "." + hashtags);
- }
- //next part with text
- int hashtags = (n - 1) / 2;
- int spaces = n / 2;
- System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "S" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
- System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "O" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
- System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "F" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
- System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "T" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
- //middle part
- for (int i = 0; i < n-4; i++) {
- System.out.println(repeatStr("#", (n - 1) / 2) + "|" + repeatStr(" ", width - 2 - 2 * ((n - 1) / 2)) + "|" + repeatStr("#", (n - 1) / 2));
- }
- System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "U" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
- System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "N" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
- System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "I" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
- // one row
- System.out.println("@" + repeatStr("=", width - 2) + "@");
- //next part
- for (int i = 0; i < n / 2; i++) {
- String hashtags1 = repeatStr("#", (n+1)/2+1);
- System.out.println(hashtags1 + "|" + repeatStr(" ", width - 2 * ((n+1)/2+1) - 2) + "|" + hashtags1);
- }
- //last row
- System.out.println(repeatStr("#", (n+1)/2+1) + "\\" + repeatStr(".", width - 2 * ((n+1)/2+1) - 2) + "/" + repeatStr("#", (n+1)/2+1));
- }
- static String repeatStr(String strToRepeat, int count) {
- String text = "";
- for (int i = 0; i < count; i++) {
- text = text + strToRepeat;
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment