选大王

 1 #include <iostream>
 2 #include <algorithm>
 3 using namespace std;
 4 
 5 int main(){
 6     int n, m;
 7     while (cin >> n >> m){
 8         int ans = 0;
 9         for (int i = 2; i <= n; i++){
10             ans = (ans + m) % i;
11         }
12         cout << ans + 1 << endl;
13     }
14 
15     return 0;
16 }

 

posted @ 2018-03-06 21:36  ouyang_wsgwz  阅读(138)  评论(0编辑  收藏  举报