class Solution {
public:
/**
*
* @param n int整型
* @param m int整型
* @return int整型
*/
int ysf(int n, int m) {
// write code here
queue<int> ans;
for(int i=1;i<=n;++i){ans.push(i);}
int han=1;
int xx;
while(true){
int now = ans.front();
ans.pop();
if(han==m){
han = 1;
if(ans.empty()){
return now;
break;
}
}
else{
han+=1;
ans.push(now);
}
}
}
};

京公网安备 11010502036488号