提交时间:2024-02-24 12:09:28

运行 ID: 42203

#include<bits/stdc++.h> using namespace std; int main() { int n,m,p=0,cnt=0,i=0; while(cin>>n>>m&&n&&m){ bool s[300]={true}; while(cnt>0){ p++; if(p==m){ cnt--; s[i]=false; } i++; i%=n; } for(int i=0;i<n;i++){ if(s[i]==true){ cout<<i+1<<endl; } } } return 0; }