Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Crown {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int b = 2* ((2*n - 1)/3 - 2 ) -1;
- String firstLine = "@"
- + repeatStr(" ", n - 2)
- + "@"
- + repeatStr(" ", n - 2)
- + "@";
- System.out.println(firstLine);
- String secondLine = "**"
- + repeatStr(" ", n - 3)
- + "*"
- + repeatStr(" ", n - 3)
- + "**";
- System.out.println(secondLine);
- for (int i = 0; i < n / 2 - 2; i++) {
- String mainBody = "*"
- + repeatStr(".", 1 + i)
- + "*"
- + repeatStr(" ", (n -5) - 2 * i)
- + "*"
- + repeatStr(".", 1 + 2 * i)
- + "*"
- + repeatStr(" ", (n -5) - 2 * i)
- + "*"
- + repeatStr(".", 1 + i)
- + "*";
- System.out.println(mainBody);
- }
- String line1 = "*"
- + repeatStr(".", (2 * n - 1) / 3 - 2)
- + "*"
- + repeatStr(".", b)
- + "*"
- + repeatStr(".", (2 * n - 1) / 3 - 2)
- + "*";
- System.out.println(line1);
- String line2 = "*"
- + repeatStr(".", n / 2)
- + "*"
- + repeatStr("*", (n - 6) / 2)
- + "."
- + repeatStr("*", (n - 6) / 2)
- + "*"
- + repeatStr(".", n / 2)
- + "*";
- System.out.println(line2);
- String lastLines = repeatStr("*", 2 * n - 1);
- System.out.println(lastLines);
- System.out.println(lastLines);
- }
- static String repeatStr(String strToRepeat, int count) {
- String text = "";
- for (int i = 0; i < count; i++) {
- text += strToRepeat;
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement