Advertisement
Ivakis

Cup

Aug 31st, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 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. System.out.println(repeatStr(".", n + i)
  11. + repeatStr("#", n * 3 - i * 2)
  12. + repeatStr(".", n + i));
  13. }
  14. for (int i = 0; i < n / 2 + 1; i++) {
  15. System.out.println(repeatStr(".", n + n / 2 + i)
  16. + "#"
  17. + repeatStr(".", n * 2 - 2 - i * 2)
  18. + "#"
  19. + repeatStr(".", n + n / 2 + i));
  20. }
  21. System.out.println(repeatStr(".", n * 2)
  22. + repeatStr("#" , n )
  23. + repeatStr(".", n * 2));
  24.  
  25. for (int i = 1; i <= n + 2; i++) {
  26.  
  27. if(i != n / 2 + 1){
  28. System.out.println(repeatStr(".", n * 2 - 2)
  29. + repeatStr("#" , n + 4 )
  30. + repeatStr(".", n * 2 - 2));
  31. }else{
  32. System.out.println(repeatStr(".", (5 * n - 10)/2)
  33. + "D^A^N^C^E^" + repeatStr(".", (5 * n - 10)/2));
  34. }
  35. }
  36. }
  37.  
  38. static String repeatStr(String strToRepeat, int count) {
  39. String text = "";
  40. for (int i = 0; i < count; i++) {
  41. text += strToRepeat;
  42. }
  43. return text;
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement