对于平面图形输出集合图形与数字组合的,用二维数组。先在Excel表格中分析一下,找到简单的规律。二维数组的行数为行高,列数为最后一个数大小。
对于减小再增大再减小再增大的,可以用一个boolean标志其是增加还是减小状态,减到最小时将其标志设为相反的并改变这时的初值大小。
效果:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAARwAAACqCAIAAADwcmdrAAAGxElEQVR4nO3dO47iQBhF4dkZSyFhGxaRl2DJKyBxyAosOSUld+KERdQEdDd+lB/g2/Zf1edTa4QYGjwjH8oUfvxzAKT+7b0AQGyIChAjKkCMqAAxogLEiAoQIypAjKgAMaICxIgKECMqQIyoADGiAsSIChAjKkCMqAAxogLEiAoQIypAjKgAsV2iai7Z8VQ23Ttv6Tmv9lgaQGuPqO75odVPXSansnHulmbX2rmqOKb3HRYKUNkhqqroDVO39Hw8ZHla5Gl2PDBeIXCbR/W4ns7J5bH4fiA0W0dVl8mhuHXvay5Za6TKrvXGywRIbRzVLT33PzLxmQqR2Taq7hRFF7N/iMSWUXln0oHYbBgVUxH4G7aLqiqOgykKIEKbReWZogCitFFUdZkwV44/YpuomKLAH8Je6oAYUQFiRAWIERUgRlSAGFEBYkQFiBEVIEZUgBhRAWJEBYgRFSBGVIAYUQFiRAWIERUgRlSAGFEBYkQFiBEVIEZUgBhRAWJEBYgRFSBGVIAYUQFiEUZVl8nhfPz5sXdVhFvaWryvH040H5EIo+q45wfrF8VqLhkXGYpK7FHZv4RPANnjPZFHZf4SPgxTEYozqtbHKtuDAMNUjOKM6uVxPZ3NXhqLYSpOsUdleQuQK4tHKv6ozF7AuyqYSY9T7FGZ/dDyuJ6MT0viUxFGVRXt71Xzau/l8WkuGcNUtCKMCtgXUQFiRAWIERUgRlSAGFEBYkQFiBEVIEZUgFjAUbX2nFDuiPR12Ihqd8F7Ljywv7OzCDtkWBVqVHWZ/Kz3dZnIunpcT+fkpDkio7lkyv2kujvgctiIXaFG1SHbObW5ZMdT2Wh2bL/n0sGkX5HdQ1r+PKJ6qcvkOb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GRkZGRkZCzOKeEZGRkZGRkZGRsbCjCKekZGRkZGRkZGRsTCjiGdkZGRkZGRkZGQszCjiGRkZGRkZGRkZGQsz/n/K82ib0cJipgAAAABJRU5ErkJggg==" alt="" />
Java代码:
package Java_Test; public class PrintM { /* 3 7
2 4 6 8
1 5 9
平面图形(二维数组) */
public static void main(String[] args) { int atr[][]=new int[3][9];
// 产生9个数,放入对应位置
boolean flag=false; //false代表横坐标在减小,true代表在增大
// 初始位置
int x=2;
int y=0;
for(int i=1;i<=9;i++){ // 放入第一个数
atr[x][y]=i;
// y始终在增大
y++; if(!flag){ //如果x在减小让其自减
x--;
} if(flag){
x++;
} if(x<0){ //x减到0,再减为-1
flag=true;
x=x+2;
} if(x>2){ //x加2,再加为3
flag=false;
x=x-2;
}
} for(int i=0;i<3;i++){
for(int j =0;j<9;j++){
if(atr[i][j]==0){
System.out.print(" ");
}else{
System.out.print(atr[i][j]);
}
}
System.out.println();
} }
}
测试:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAANgAAACGCAIAAAAwxtM9AAAL+ElEQVR4nO2db3AUZx3Hd6Y6jiOObxxnfOUbZ+qAHTpIX9w1DTqhNcxoKdUCrWkClGwokGAgieBQrkqFxBbuCAhYzkIUJ4Viyxh6wSljlKH0hdRc8sqZU+8YGRVichEqMk2d9cXe7T7P7rN3+9u7Z+9J8v3M8+Lu2efZffb3fO559l82miHi+t/vssnMvFcjpsE8QPMjouUiAJLwKyJcBFIhiAgdgTzIIiIhyUgQEUmJBBGRlEgQEUmJRBYxdekaElLVE0FEs8L49ek5lgzDMHdNGIr5Rq162a+Ic1JBy8Jw+3oWEH53+xJxrlo4fn0aFnoRcqfPaxENDIfeKCdi6tK1sdz0nEywsDRhdj1EBJ5AxJqJ+Me/TK+IXf36nne90hN738venC833BUUMS9MXes7rM/PPxOzPndvaPeqolRyi1jXc3ml/soTrS97pZVtB76267J8B5SgRNdXPVUk4uam7rFc/r03Nw50LxjoXvCLngV/+PX6sVy+o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EETElG72kNTnmwuEJ6LLPPbvb4IAESlUcow490Tkt1ThE2IQkcJsEDGUZ2WcQ2Llh8AQkYLqInJQ/vwg+AaKJ0WpCo8SISKFWSViqP+wCseIoTK7RAzzBe0VOw8RKcwmEcN7QXvFf/BgGBCRRhARBX8QIE2PkN5TYxhG1f9DG0SkgFt80kC4KEBEaSBcFOgiIpES8AdEhIhKQBERAGlARKAEEBEoAUQESgARgRJARKAEEBEoAUQESgARgRJARKAEEBEoAUQESgARgRJARKAEEBEoAUQESgARgRJARKAEEBEoAUQESgARgRJARKAE/wfb3xaeuYvfNAAAAABJRU5ErkJggg==" alt="" />
-------------------------------------------------------输入n个数输出M的改造--------------------------------
package Java_Test; import org.junit.Test; public class PrintM_duogeshu { /*
*
* 3 7 2 4 6 8 1 5 9 平面图形(二维数组)
*
*/
public static void test1(int num) { int height = (num / 4) + 1; // 4条边 int atr[][] = new int[height][num];
// 产生9个数,放入对应位置
boolean flag = false; // false代表横坐标在减小,true代表在增大
// 初始位置
int x = height-1;
int y = 0;
for (int i = 1; i <= num; i++) { // 放入第一个数
atr[x][y] = i;
// y始终在增大
y++; if (!flag) { // 如果x在减小让其自减
x--;
} if (flag) {
x++;
} if (x < 0) { // x减到0,再减为-1
flag = true;
x = x + 2;
} if (x > height-1) { // x加2,再加为3
flag = false;
x = x - 2;
}
} for (int i = 0; i < atr.length; i++) {
for (int j = 0; j < atr[i].length; j++) {
if (atr[i][j] == 0) {
System.out.print(" ");
} else {
System.out.print(atr[i][j]);
}
}
System.out.println();
} } @Test
public void test(){
PrintM_duogeshu.test1(13);
}
}
测试:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOYAAACRCAIAAABYL1OVAAAOk0lEQVR4nO2d7XMbxRnA7+8hw8AwfBL50BnLtP3QodNpZ2gLDMMQGRFiJzBh0g5QXk1b3oTt2GmqxEkmQwIGxWli2U5SDMWQkDhYdiwrihwjv8SvkSLLUmTHmO2H093t3t2uTmfdae/0/Ob5IK1u757b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mN5JUJd26heAniorPX7/ezlb80tU73gGH1lj33Xs7n+zU9r32zeGzw+1IcQ6gheRAglkvMn+sZP9EVP9EZvTM5o6hUlwg3KRELy00wkhMmmLUYIJQeCoUim3Fr6zC+kVrI5PLY9eXjnvo+HUxvpzN3UnfxyOreUWl1czi4sZRZvryCEdv21dduTh8la461eobEnp1rVSjY31uYVvPvHxKfR/XWCtzUqlQvFKtIyOithVW/sFR/UtY0rCzf2anOQA2HzVxG/389YfiWbm19IsZqPV/SVPXzh1MWbx8U48vUphFDrwYsIoZP943P5ghgnemlnsonjo+iWMhLiA6JKN3l4lsoN12J+zFtcSmdX83hseyK459X9jInBS3/r2PZEkKwVa/MKjeG8alXa8p5GwdsWy67mo21eobGvWB5t9wpNPWKhUFzAWPVYmzIEi6Nze1SdQzGQxlcRv9+vu7wYi0tpWjvwjL6yg9HRf50+efDMyYNnTn7542WE0Ecd3yOEOkNXzt+4KUZnaIixXlw+7VioKRUHV3lsNVirWDMY1B9ul1OZ1dxdPO5/6tDeNw785Z1/73v7oG68+PqBh57pVNWK7vcKTX2qwtXc9Tav0NirlISbBO/+6+rlx9u9wu4wtowgiLVKVlcvwAjZV/Gx6tMYrdZyqupf6piB9fHrvdZh+fH77UMIofGJxUOfXTzcdelQ16Vz36pOBcIP5uTRXPM1gla+5EAwFAoR09YStTKRCDmZ0JC+k83nC3h0fxXz+I5ubziyveHI9obOR6TY3tApFR4djEypauXz/U2CIDT1S0/j7d7dfflCrL1e8HbExMJYh1eob48V8mK5vHCswyvs7svH29uLJX1Ngrc9njdQnVigb3dTX0GTWDFER8UHeAlCSC7RRvpOltH73MJS9p9tEeXx/qvy43dbruotjvCPTLhESqkknM54mYmEyMGydC15CcrkILOSKxTWVTG7uHJzNj0xk65/8fP7Hm8V49GXvrg5m745m55fXtFWKRTWC4VER718hK7viBfL+3frFMY76oXd54sV4wfqhT39hfVC/x5pwQPxgtHqygLyCvVC/tWgZCEemZUco/e5xc3nGGSz+bW1dTxy+cKv9obu+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