#include <stdio.h>
int main() {
int n,front=0;
scanf("%d",&n);
int rear=n;
int num[1000000];
for(int j=0; j<n; j++) {
num[j]=j+1;
}
// 현재 카드 수
while(rear-front>1) {
//첫 장 버림
front++;
// 맨 뒤로 보내기
num[rear]=num[front];
front++;
rear++;
}
printf("%d",num[front]);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: