forked from mejibyte/live-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3882.cpp
43 lines (40 loc) · 808 Bytes
/
3882.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <cassert>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <locale.h>
#include <vector>
#include <string>
#include <string.h>
#include <set>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <sstream>
#include <fstream>
#include <math.h>
#include <algorithm>
using namespace std;
int main() {
int n,m,k;
cin >> n >> k >> m;
while(n) {
vector<int> t(n);
for(int i = 0; i<t.size(); ++i) {
t[i] = i +1;
}
int pos = m-1;
t.erase(t.begin() + pos);
pos--;
for(int i =n-1; i>1; i--) {
pos = (pos+k)%i;
t.erase(t.begin() + pos);
pos--;
}
cout << t[0] << endl;
cin >> n >> k >> m;
}
return 0;
}