蓝桥杯 基础练习 字母图形 JAVA

import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		char c = 'A';
		int i = 0;
		while (i < n) {
			char d = c;
			int k = -1;
			for (int j = 0; j < m; j++) {
				if (j == 0)
					System.out.print(d);
				else {
					if (d == 'A')
						k = 1;
					d = (char) (d + k);
					System.out.print(d);
				}

			}
			System.out.println();

			i++;
			c++;
		}

	}

}



你可能感兴趣的:(蓝桥杯,java)