Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <cctype>
- #include <stack>
- #include <queue>
- #include <list>
- #include <vector>
- #include <map>
- #include <set>
- #define N 1000000
- #define LL unsigned long long
- using namespace std;
- int get_value(char c){
- switch(c){
- case '2': return 2;
- case '3': return 3;
- case '4': return 4;
- case '5': return 5;
- case '6': return 6;
- case '7': return 7;
- case '8': return 8;
- case '9': return 9;
- default : return 10;
- }
- }
- int main() {
- string arr[52];
- stack <string> s;stack <string> hand;
- string cad;
- int t,cont,x,y;
- scanf("%d",&t);
- cont=1;
- while(t--){
- for(int i=0;i<52;i++){
- cin>>cad;
- s.push(cad);
- }
- /*consigo una mano*/
- for(int i=0;i<25;i++){
- hand.push(s.top());
- s.pop();
- }
- y=0;
- /*proceso de simulación*/
- for(int i=0;i<3;i++){
- /*saco la carta*/
- cad=s.top();
- x=get_value(cad[0]);
- y+=x;
- s.pop();
- for(int j=0;j<10-x;j++){
- s.pop();
- }
- }
- /*apilamos la mano*/
- for(int i=0;i<25;i++){
- s.push(hand.top());
- hand.pop();
- }
- int j=0;
- while(!s.empty()){
- arr[j]=s.top();
- s.pop();
- j++;
- }
- j--;
- j=j-y;
- printf("Case %d: ",cont);
- cont++;
- cout<<arr[j]<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement