-
Notifications
You must be signed in to change notification settings - Fork 0
/
P15721.cpp
50 lines (40 loc) · 989 Bytes
/
P15721.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
44
45
46
47
48
49
50
#include <iostream>
#define BBUN 0
#define DEGI 1
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int A, T, C;
cin >> A >> T >> C;
int B = 0, D = 0;
int round = 2;
while (round-2 < T) {
for (int i = 0; i < 4; i++) { // 뻔 데기 뻔 데기
if (i % 2 == 0) B++;
else D++;
if ((T == B && C == BBUN) || (T == D && C == DEGI)) {
cout << (B + D - 1) % A;
return 0;
}
}
// 뻔
for (int i = 0; i < round; i++) {
B++;
if (B == T && C == BBUN) {
cout << (B + D - 1) % A;
return 0;
}
}
// 데기
for (int i = 0; i < round; i++) {
D++;
if (D == T && C == DEGI) {
cout << (B + D - 1) % A;
return 0;
}
}
round++;
}
}