Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class ScotlandPanda {
- private static char returnCode(int a) {
- if (a % 26 == 0) {
- a = 26;
- }
- if (a > 26) {
- a = a % 26;
- }
- return (char) (64 + a);
- }
- public static void main(String[] args) {
- @SuppressWarnings("resource")
- Scanner input = new Scanner(System.in);
- int n = input.nextInt();
- int alfa = 1;
- for (int i = 0; i < n/2; i++) {
- System.out.printf("%s%s%s%s%s\n", new String(new char[i]).replace('\0', '~'),
- returnCode(alfa),
- new String(new char[n-2 - (2*i)]).replace('\0', '#'),
- returnCode(alfa+1),
- new String(new char[i]).replace('\0', '~'));
- alfa+=2;
- }
- System.out.printf("%1$s%2$s%1$s\n", new String(new char[n/2]).replace('\0', '-'),
- returnCode(alfa));
- alfa++;
- for (int i = n/2 - 1; i >= 0; i--) {
- System.out.printf("%s%s%s%s%s\n", new String(new char[i]).replace('\0', '~'),
- returnCode(alfa),
- new String(new char[n-2 - (2*i)]).replace('\0', '#'),
- returnCode(alfa+1),
- new String(new char[i]).replace('\0', '~'));
- alfa+=2;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement