修改文件结构。

This commit is contained in:
unlockable
2023-02-21 10:56:54 +08:00
parent a64cfdd9f3
commit 40182871f4
83 changed files with 0 additions and 0 deletions

32
POP/11/Exercise2.c Normal file
View File

@@ -0,0 +1,32 @@
#include <stdio.h>
#include <stdbool.h>
#define INCIRCLE false
#define OUTCIRCLE true
void del(int *p, int m) {
int nowPos = 0, count = 0, outCount = 0;
for (outCount = 0; outCount < m - 1; outCount++) {
count = 0;
while (count < 3) {
if ( *(p + nowPos) == INCIRCLE) {
count++;
}
nowPos = (nowPos + 1) % m;
}
*(p + ((nowPos + m - 1) % m)) = OUTCIRCLE;
}
for (;;nowPos = (nowPos + 1) % m) {
if (*(p+nowPos) == INCIRCLE) {
printf("%d\n", nowPos + 1);
break;
}
}
}
int main() {
int num[50] = {0};
int n = 0;
scanf("%d", &n);
del(num, n);
return 0;
}