Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package mask;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class Mask {
- public static String strRepeat(String str, int count) {
- String result = "";
- for (int i = 0; i < count; i++) {
- result += str;
- }
- return result;
- }
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- int n = Integer.parseInt(reader.readLine());
- int length = 4 * n - 1;
- int width = (2 * n) + 2;
- int spaces = n - 3;
- System.out.printf("%s/| |\\\n", strRepeat(" ", n-2));
- for (int i = 1; i < n-1; i++) {
- System.out.printf("%s/%s| |%s\\\n",
- strRepeat(" ", spaces),
- strRepeat(" ", i),
- strRepeat(" ", i));
- spaces--;
- }
- System.out.println(strRepeat("-", width));
- /*
- System.out.printf("|%s_%s_%s|\n", strRepeat(" ", n/3),
- strRepeat(" ", width - (2 * (n/3) + 4)),
- strRepeat(" ", n/3));
- System.out.printf("|%s@%s@%s|\n", strRepeat(" ", n/3),
- strRepeat(" ", width - (2 * (n/3) + 4)),
- strRepeat(" ", n/3));
- */
- String t = strRepeat(" ",(n - 3) / 2);
- System.out.println("|" + t + "_" + strRepeat(" ",2*n+2 - 2*(t.length() +2)) + "_" + t + "|");
- System.out.println("|" + t + "@" + strRepeat(" ",2*n+2 - 2*(t.length() +2)) + "@" + t + "|");
- for (int i = 0; i < n / 2; i++) {
- System.out.printf("|%s|\n", strRepeat(" ", width - 2));
- }
- System.out.printf("|%sOO%s|\n", strRepeat(" ", n-1), strRepeat(" ", n-1));
- System.out.printf("|%s/ \\%s|\n", strRepeat(" ", n-2), strRepeat(" ", n-2));
- System.out.printf("|%s||||%s|\n", strRepeat(" ", n-2), strRepeat(" ", n-2));
- System.out.printf("\\%s/\n", strRepeat("`", width - 2));
- for (int i = 2; i <= n; i++) {
- System.out.printf("%s%s%s\n", strRepeat("\\", i),
- strRepeat("`", width - (2 * i)),
- strRepeat("/", i));
- }
- System.out.printf("%s%s", strRepeat("\\", width/2), strRepeat("/", width/2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement