TopCoder Training——How To Find a Solution

BusinessTasks - SRM 236 Div 1:

View Code
#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
#include <map>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

//#define DEBUG
class BusinessTasks{
public:
string getTask(vector <string> list, int n){
int s = 0;
while(list.size() > 1){
s = (s+n-1) % list.size();
list.erase(list.begin()+s);
}
return list[0];
}
};









posted on 2012-03-22 16:04  Moon_1st  阅读(244)  评论(0编辑  收藏  举报

导航