算法day15-----蛇形填数

 

 容易看出矩阵第二行第二列中的数是 5。请你计算矩阵中第 20 行第 20 列 的数是多少?

public static void main(String[] args) {
int res=1;
int t=4;
for(int i=2;i<=20;i++) {
res+=t;
t+=4;
}
System.out.println(res);

}

 

posted @ 2022-06-16 21:40  开源遗迹  阅读(25)  评论(0)    收藏  举报