Advertisement
Ivakis

Купа

Oct 17th, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8.  
  9. for (int i = 0; i < n / 2; i++) {
  10. String line = repeatStr(".", n + i)
  11. + repeatStr("#", n * 3 - i * 2)
  12. + repeatStr(".", n + i);
  13. System.out.println(line);
  14. }
  15. for (int i = 0; i < n / 2 + 1; i++) {
  16. String line = repeatStr(".", n + n / 2 + i)
  17. + "#"
  18. + repeatStr(".", n * 5 - ((n + n / 2 + i) * 2) - 2)
  19. + "#"
  20. + repeatStr(".", n + n / 2 + i);
  21. System.out.println(line);
  22. }
  23. String middleRow = repeatStr(".", n * 2)
  24. + repeatStr("#", n)
  25. + repeatStr(".", n * 2);
  26. System.out.println(middleRow);
  27.  
  28. for (int i = 1; i <= n + 2; i++) {
  29.  
  30. if (n / 2 + 1 == i) {
  31. String line = repeatStr(".", (n * 5 - 10) / 2)
  32. + "D^A^N^C^E^"
  33. + repeatStr(".", (n * 5 - 10) / 2);
  34. System.out.println(line);
  35. }else{
  36. String line = repeatStr(".", (n * 5 - (n + 4)) / 2)
  37. + repeatStr("#", n + 4)
  38. + repeatStr(".", (n * 5 - (n + 4)) / 2);
  39. System.out.println(line);
  40. }
  41.  
  42. }
  43. }
  44.  
  45. static String repeatStr(String strToRepeat, int count) {
  46. String text = "";
  47. for (int i = 0; i < count; i++) {
  48. text += strToRepeat;
  49. }
  50. return text;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement