文章
11
粉丝
406
获赞
3
访问
85.4k
#include<iostream>
using namespace std;
int main(){
int num;
cin>>num;
int *n=new int[num];
// memset(n, 0xff, sizeof(n));
for(int i=0;i<num;i++){
n[i]=1;
}
int count=0,local_count=0,locate=-1;
while(count<num){
local_count=0;
while(local_count<3){
locate=(locate+1)%num;
if(n[locate]!=0){
local_count++;
}
}
n[locate]=0;
count++;
}
cout<<locate+1;
}
登录后发布评论
暂无评论,来抢沙发