解题思路:
注意事项:每两个U之间,要有一个空行 ! ! !
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()){ int n = sc.nextInt(); int [][]a = new int[n+1][n+2]; for (int i=0;i<n+1;i++){ for (int j=0;j<n+2;j++){ if (j==0||j==n+1||i==n){ System.out.print("*"); }else { System.out.print(" "); } } System.out.println(); } System.out.println(); } } }
0.0分
1 人评分