velikova_olya

Sword

Mar 13th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. package Exam10thMarch;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Sword {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int n = Integer.parseInt(scanner.nextLine());
  10. int width = 2 * n + 1;
  11.  
  12. //first line
  13. System.out.println(repeatStr("#", n - 1) + "/^\\" + repeatStr("#", n - 1));
  14.  
  15. //first part
  16. for (int i = 0; i < n / 2; i++) {
  17. String hashtags = repeatStr("#", n - 2 - i);
  18. String spaces = repeatStr(" ", 3 + 2 * i);
  19. System.out.println(hashtags + "." + spaces + "." + hashtags);
  20. }
  21.  
  22. //next part with text
  23. int hashtags = (n - 1) / 2;
  24. int spaces = n / 2;
  25. System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "S" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
  26. System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "O" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
  27. System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "F" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
  28. System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "T" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
  29.  
  30. //middle part
  31. for (int i = 0; i < n-4; i++) {
  32. System.out.println(repeatStr("#", (n - 1) / 2) + "|" + repeatStr(" ", width - 2 - 2 * ((n - 1) / 2)) + "|" + repeatStr("#", (n - 1) / 2));
  33. }
  34.  
  35. System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "U" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
  36. System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "N" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
  37. System.out.println(repeatStr("#", hashtags) + "|" + repeatStr(" ", spaces) + "I" + repeatStr(" ", spaces) + "|" + repeatStr("#", hashtags));
  38.  
  39. // one row
  40. System.out.println("@" + repeatStr("=", width - 2) + "@");
  41.  
  42. //next part
  43. for (int i = 0; i < n / 2; i++) {
  44. String hashtags1 = repeatStr("#", (n+1)/2+1);
  45. System.out.println(hashtags1 + "|" + repeatStr(" ", width - 2 * ((n+1)/2+1) - 2) + "|" + hashtags1);
  46. }
  47.  
  48. //last row
  49. System.out.println(repeatStr("#", (n+1)/2+1) + "\\" + repeatStr(".", width - 2 * ((n+1)/2+1) - 2) + "/" + repeatStr("#", (n+1)/2+1));
  50. }
  51.  
  52. static String repeatStr(String strToRepeat, int count) {
  53. String text = "";
  54. for (int i = 0; i < count; i++) {
  55. text = text + strToRepeat;
  56. }
  57. return text;
  58. }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment