码迷,mamicode.com
首页 > 其他好文 > 详细

选大王

时间:2018-03-06 23:21:10      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:namespace   AC   str   pac   std   for   end   body   span   

 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 }

 

选大王

标签:namespace   AC   str   pac   std   for   end   body   span   

原文地址:https://www.cnblogs.com/jaydenouyang/p/8516926.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!