/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package arthur.datastruct.suanfa;
/**
*
* @author dell
*/
public class HuiXing {
public static void main(String[] args) {
int a[][] = getArray1(4);
System.err.println();
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a.length; j++) {
System.out.print(a[i][j] + " ");
}
System.out.println();
}
}
public static int[][] getArray1(int n) {
int arr[][] = new int[2 * n - 1][2 * n - 1];
int rowMin = 0;
int rowMax = arr.length - 1;
int colMin = 0;
int colMax = arr.length - 1;
while (n != 0) {
if (1 == n) {
int center = (arr.length - 1) >> 1;
arr[center][center] = 1;
break;
} else {
//为最上面的那一行赋值
for (int i = colMin; i
关注
打赏
热门博文
- Flutter之Widget构建过程详解
- Flutter之Widget 更新机制原理浅析
- 从源码角度分析android事件分发处理机制
- android事件拦截处理机制详解
- android 获取IP地址
- android 获取生肖和星座
- Android TextView setCompoundDrawables设置图片不显示解决方案
- Android Stuido集成LeakCanary编译失败TransformException、transformClassesWithDexBuilderForDebug
- Flutter实战之go_router路由组件入门指南
- HarmonyOS鸿蒙学习笔记(9)Navigator组件实现页面路由跳转