改个错。

This commit is contained in:
unlockable
2022-11-18 09:57:27 +08:00
parent b4c35a325c
commit 605137a437

View File

@@ -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++;