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];
}
};