32 lines
712 B
C
32 lines
712 B
C
#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;
|
|
} |