-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10646.cpp
57 lines (43 loc) · 846 Bytes
/
10646.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
51
52
53
54
55
56
57
// SOLVED
#include <bits/stdc++.h>
using namespace std;
int main(){
int tc, x, y;
deque<string> top, bot;
string r;
scanf("%d\n", &tc);
for(int i = 1; i <= tc; i++){
top.clear();
bot.clear();
for(int j = 0; j < 27; j++){
cin >> r;
bot.push_back(r);
}
for(int j = 0; j < 25; j++){
cin >> r;
top.push_back(r);
}
scanf("\n");
y = 0;
for(int j = 0; j < 3; j++){
x = (bot.back()[0] >= '2' && bot.back()[0] <= '9')
? bot.back()[0] - '0' : 10;
y += x;
bot.pop_back();
x = 10 - x;
while(x--){
bot.pop_back();
}
}
while(!top.empty()){
bot.push_back(top.front());
top.pop_front();
}
y--;
while(y--){
bot.pop_front();
}
printf("Case %d: ", i);
cout << bot.front() << endl;
}
}