改个错。
This commit is contained in:
@@ -12,7 +12,7 @@ void iteration() {
|
||||
while (nowDead < 39) {
|
||||
nowCount = 0;
|
||||
while (nowCount < 3) {
|
||||
if (people[nowPos]==ALIVE) {
|
||||
if (people[nowPos % 40]==ALIVE) {
|
||||
nowCount++;
|
||||
}
|
||||
nowPos++;
|
||||
@@ -21,7 +21,7 @@ void iteration() {
|
||||
nowDead+=1;
|
||||
}
|
||||
for (nowPos = 0; nowPos < 40; nowPos++) {
|
||||
if (people[nowPos] == ALIVE) {
|
||||
if (people[nowPos % 40] == ALIVE) {
|
||||
printf("Stand at %d\n", nowPos+1);
|
||||
break;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ int recursion(int nowDead, int nowPos) {
|
||||
int nowCount=0;
|
||||
if (nowDead == 39) {
|
||||
for (nowPos = 0; nowPos < 40; nowPos++) {
|
||||
if (people[nowPos] == ALIVE) {
|
||||
if (people[nowPos % 40] == ALIVE) {
|
||||
// printf("Stand at %d\n", nowPos+1);
|
||||
return nowPos;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ int recursion(int nowDead, int nowPos) {
|
||||
}
|
||||
else {
|
||||
while (nowCount < 3) {
|
||||
if (people[nowPos]==ALIVE) {
|
||||
if (people[nowPos % 40]==ALIVE) {
|
||||
nowCount++;
|
||||
}
|
||||
nowPos++;
|
||||
|
||||
Reference in New Issue
Block a user