#include <stdio.h>
#include <stdlib.h>/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *argv[]) {int n;while(scanf("%d",&n)!=EOF){int i;int a[n];//賦值 for (i=0;i<n;i++)a[i]=i+1;int count=0,baoshu=1,xu=1;//報數(shù)開始 while(count!=n-1){if(a[xu-1]!=0)//判斷是否退出 {//退出 if(baoshu==3){baoshu=1;count++;printf("%d ",a[xu-1]);//輸出退出 a[xu-1]=0;//標記退出 }else{baoshu++;} } //加序號 if(xu==n)xu=1;elsexu++; }//輸出最后一個 for (i=0;i<n;i++){if(a[i]!=0)printf("%d\n",a[i]);}}return 0;
}