Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Sheriff {
- public static void main(String[] args) {
- Scanner scanner=new Scanner(System.in);
- int n=Integer.parseInt(scanner.nextLine());
- int m=n;
- int p=n;
- int q=n;
- int a1=0;
- int a2=0;
- int count_tochki=((3*n)-1)/2;
- int lenght_red=3*n;
- int half_red=(lenght_red-1)/2;
- int half_koloni=(((2*n)+8)-8)/2;
- { System.out.print(repeatStr(".",count_tochki));
- System.out.print("x");
- System.out.println(repeatStr(".",count_tochki));//red 1
- System.out.print(repeatStr(".",count_tochki-1));
- System.out.print("/x\\");
- System.out.println(repeatStr(".",count_tochki-1));//red 2
- System.out.print(repeatStr(".",count_tochki-1));
- System.out.print("x|x");
- System.out.println(repeatStr(".",count_tochki-1));//red3
- for ( int a = 0; a <(half_koloni-1)/2 ; a++) {
- System.out.print(repeatStr(".",Math.abs(half_red-n)));
- System.out.print(repeatStr("x",n));
- System.out.print("|");
- System.out.print(repeatStr("x",n));
- System.out.println(repeatStr(".",(Math.abs(half_red-n))));
- n++;
- a1=a1+a;}
- System.out.print(repeatStr("x",n));
- System.out.print("|");
- System.out.println(repeatStr("x",n));
- if(m<=n){ m=n-1;
- for (int b = 0; b <(half_koloni-1)/2 ; b++) {
- System.out.print(repeatStr(".",Math.abs(half_red-m)));
- System.out.print(repeatStr("x",m));
- System.out.print("|");
- System.out.print(repeatStr("x",m));
- System.out.println(repeatStr(".",Math.abs(half_red-m)));
- m--;}}
- else {m=n+a1;
- for (int i = 0; i <(half_koloni-1)/2 ; i++) {
- System.out.print(repeatStr(".",Math.abs(half_red-m)));
- System.out.print(repeatStr("x",m));
- System.out.print("|");
- System.out.print(repeatStr("x",m));
- System.out.println(repeatStr(".",Math.abs(half_red-m)));
- m--;}}
- System.out.print(repeatStr(".",count_tochki-1));
- System.out.print("/x\\");
- System.out.println(repeatStr(".",count_tochki-1));
- System.out.print(repeatStr(".",count_tochki-1));
- System.out.print("\\x/");
- System.out.println(repeatStr(".",count_tochki-1));
- //dolna chast
- {
- for (int j = 0; j <(half_koloni-1)/2 ; j++) {
- System.out.print(repeatStr(".",Math.abs(half_red-p)));
- System.out.print(repeatStr("x",p));
- System.out.print("|");
- System.out.print(repeatStr("x",p));
- System.out.println(repeatStr(".",Math.abs(half_red-p)));
- p++;
- a2=a2+j;}
- System.out.print(repeatStr("x",p));
- System.out.print("|");
- System.out.println(repeatStr("x",p));
- if(q<=p){q=p-1;
- for ( int d = 0; d <(half_koloni-1)/2 ; d++)
- {System.out.print(repeatStr(".",Math.abs(half_red-q)));
- System.out.print(repeatStr("x",q));
- System.out.print("|");
- System.out.print(repeatStr("x",q));
- System.out.println(repeatStr(".",Math.abs(half_red-q)));
- q--;}}
- else
- {q=p+a2;
- q++;
- for (int f = 0; f <(half_koloni-1)/2 ; f++) {
- System.out.print(repeatStr(".",Math.abs(half_red-q)));
- System.out.print(repeatStr("x",q));
- System.out.print("|");
- System.out.print(repeatStr("x",q));
- System.out.println(repeatStr(".",Math.abs(half_red-q)));
- q--;}}
- System.out.print(repeatStr(".",count_tochki-1));
- System.out.print("x|x ");
- System.out.println(repeatStr(".",count_tochki-1));
- System.out.print(repeatStr(".",count_tochki-1));
- System.out.print("\\x/");
- System.out.println(repeatStr(".",count_tochki-1));
- System.out.print(repeatStr(".",count_tochki));
- System.out.print("x");
- System.out.println(repeatStr(".",count_tochki));}}}
- 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