蓝桥网试题 java 基础练习 字母图形
-----------------------------------------------------------------
不知道说啥
感觉好像偏离主体思想了
但是这样写好简单
-----------------------------------------------------------------
算法
1 import java.util.*; 2 public class Main { 3 public static void main(String[] args) { 4 Scanner sc = new Scanner(System.in); 5 int n = sc.nextInt(); 6 int m = sc.nextInt(); 7 char[] ch = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N', 8 'O','P','Q','R','S','T','U','V','W','X','Y','Z'}; 9 String st = ""; 10 for(int i=0;i<m;i++) 11 st += ch[i]; 12 for(int i=0;i<n;i++){ 13 String st1,st2; 14 if(i!=0){ 15 st1 = st.substring(0, st.length()-1); 16 st2 = ch[i]+""; 17 st = st2+st1; 18 } 19 System.out.println(st); 20 } 21 } 22 }