作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
Possible Duplicate:
Pattern consisting of numbers moving in clockwise direction around a rectangular shape (length and breadth decreasing each time)
如何使用 JAVA 以螺旋顺序打印二维数组?请帮忙,我不知道。
示例数组:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
输出:
1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
这是我尝试过的:
public static void main(String[] args) {
int[][] values = {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}};
for (int i = (values.length * values[0].length)-1, j = 0; i > 0; i--, j++) {
for (int k = j; k < i; k++) {
System.out.print(values[j][k]);
}
for (int k = j; k < i; k++) {
System.out.print(values[k][i]);
}
for (int k = i; k > j; k--) {
System.out.print(values[i][k]);
}
for (int k = i; k > j; k--) {
System.out.print(values[k][j]);
}
}
}
我正在尝试创建一个结构,如下面的屏幕截图所示。有没有办法在 JavaScript 中为此构建一个算法,以按时间顺序获取每个红点的 X 和 Y 坐标,以根据特定数量生成无限螺旋? Screenshot
我在 C++ 中有如下代码: for(int x = position.x; x GetValue(tc); } } 它的作用是生成一个梯度噪声值容器。在这样做的同时,它还会使结果围绕震中螺旋
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
我是一名优秀的程序员,十分优秀!