-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2014-05-08代码游戏 #33
Labels
Comments
|
public static void main(String[] args) {
// TODO Auto-generated method stub
int[][] s = { { 1, 1, 1, 1, 1, 1, 1 }, { 2, 0, 0, 0, 0, 0, 0 }, { 0, 2, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 2, 0 }, { 0, 0, 0, 2, 0, 0, 0 }, { 2, 0, 0, 0, 0, 0, 2 } };
System.out.println("before:");
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
System.out.print(s[i][j] + " ");
}
System.out.println();
}
for (int i = 0; i < 7; i++) {
int j = 1;
for (; j < 7; j++) {
if (s[j][i] == 2) {
break;
}
}
s[0][i] = 0;
s[j - 1][i] = 1;
}
System.out.println("after:");
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
System.out.print(s[i][j] + " ");
}
System.out.println();
}
} |
before: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
游戏的主题叫"落沙",顾名思义就是沙子落下。分别存在两种物体,沙子(@)和障碍物(#),由于重力影响沙子会从高处下落,但是如果遇到障碍物,则会在障碍物上堆积。
要求:
在给定空间内,设定空间的初始状态(设定N*N大小):
输出空间最后结果状态:
语言不限
The text was updated successfully, but these errors were encountered: