Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Cup {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int n = Integer.parseInt(scanner.nextLine());
- int j = 0;
- for (int row = 0; row < n /2; row++) {
- System.out.print(repeatStr(".", n+row));
- System.out.print(repeatStr("#", 5*n-2*(n+row)));
- System.out.println(repeatStr(".", n+row));
- j = n + row;
- }
- for (int row = 0; row < n / 2 + 1; row++){
- System.out.printf("%s#%s#%s%n",repeatStr(".", j+row+1),
- repeatStr(".",5*n-2*(j+row+2)),
- repeatStr(".", j+row+1));
- }
- System.out.printf("%s%s%s\n",repeatStr(".",2*n),
- repeatStr("#",n),
- repeatStr(".",2*n));
- for (int col = 0; col < n/2; col++){
- System.out.print(repeatStr(".", 2 *n -2));
- System.out.print(repeatStr("#", 5*n-2*(2*n-2)));
- System.out.println(repeatStr(".", 2 *n -2));
- }
- System.out.print(repeatStr(".", (5*n-10)/2));
- System.out.print("D^A^N^C^E^");
- System.out.println(repeatStr(".", (5*n-10)/2));
- for (int col = 0; col < n/2+1; col++){
- System.out.print(repeatStr(".", 2 *n -2));
- System.out.print(repeatStr("#", 5*n-2*(2*n-2)));
- System.out.println(repeatStr(".", 2 *n -2));
- }
- }
- static String repeatStr(String strToRepeat, int count) {
- String text = "";
- for (int i = 0; i < count; i++) {
- text = text + strToRepeat;
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment