Advertisement
YavorGrancharov

Axe

Mar 5th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Axe {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.         int n = Integer.parseInt(console.nextLine());
  7.  
  8.         int width = n * 5;
  9.  
  10.         int dashes = n * 3;
  11.         int dashes2 = 0;
  12.         int dashes3 = n * 2 - 2;
  13.  
  14.         for (int i = 1; i <= n; i++) {
  15.             System.out.println(repeatStr("-", dashes) + "*" + repeatStr("-", dashes2) + "*" + repeatStr("-", dashes3));
  16.             dashes2++;
  17.             dashes3--;
  18.         }
  19.  
  20.         int asterisk = n * 3 + 1;
  21.         for (int i = 0; i < n * 2 / 4; i++) {
  22.             System.out.println(repeatStr("*", asterisk) + repeatStr("-", n - 1) + "*" + repeatStr("-", n - 1));
  23.         }
  24.        
  25.         int dashes4 = n * 3;
  26.         int dashes5 = n - 1;
  27.         int dashes6 = n - 1;
  28.         for (int i = 0; i < n / 2 - 1; i++) {
  29.             System.out.println(repeatStr("-", dashes4) + "*" + repeatStr("-", dashes5) + "*" + repeatStr("-", dashes6));
  30.             dashes4--;
  31.             dashes5+=2;
  32.             dashes6--;
  33.         }
  34.  
  35.         System.out.println(repeatStr("-", dashes4) + "*" + repeatStr("*", dashes5) + "*" + repeatStr("-", dashes6));
  36.     }
  37.  
  38.     static String repeatStr(String str, int count) {
  39.         StringBuilder repeated = new StringBuilder();
  40.         for (int i = 0; i < count; i++) {
  41.             repeated.append(str);
  42.         }
  43.         return repeated.toString();
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement