#include<iostream> using namespace std; int main(){ int N,M; cout<<\"请输入N,M\"<<endl; cin>>N>>M; int* a=new int[N]; for(int i=0;i<N;i++){ a[i]=i+1; } int countN=0; int countM=0;
for(int i=0;;i++){ if(a[i%N]!=-1){ countM++; } if(countM==M){ cout<<a[i%N]<<\"\\t\"; a[i%N]=-1; countN++; countM=0; } if(countN==N){ break; } } delete a;
return 0; } |