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 new_min(int oudlers){
- switch(oudlers){
- case 1: return 51;
- case 2: return 41;
- default: return 36;
- }
- }
- int main() {
- int t,ncards,oudlers,min;double points;
- bool oudler,flag;
- scanf("%d",&t);int cont =1;
- char cad[40];char *oc,*oc1;
- flag=false;
- while(t--){
- if(flag){
- flag=false;
- printf("\n");
- }
- scanf("%d",&ncards);
- getchar();
- points=0;
- oudlers=0;
- min=56;
- for (int i=0;i<ncards;i++){
- oudler=false;
- gets(cad);
- /*verifico si es un fool*/
- oc = strstr(cad,"fool");
- if (oc==NULL) {
- oc=strstr(cad,"twenty-one");
- if(oc==NULL){
- oc=strstr(cad,"one");
- oc1=strstr(cad,"trumps");
- if(oc && oc1){
- points+=4.5;
- oudlers++;
- min=new_min(oudlers);
- oudler=true;
- }
- }else{
- points+=4.5;
- oudlers++;
- min=new_min(oudlers);
- oudler=true;
- }
- }else{
- points+=4.5;
- oudlers++;
- min=new_min(oudlers);
- oudler=true;
- }
- oc = strstr(cad,"king");
- if (oc){
- points+=4.5;
- }else{
- oc = strstr(cad,"queen");
- if(oc){
- points+=3.5;
- }else{
- oc = strstr(cad,"knight");
- if(oc){
- points+=2.5;
- }else{
- oc=strstr(cad,"jack");
- if(oc){
- points+=1.5;
- }else{
- if(!oudler)
- points+=0.5;
- }
- }
- }
- }
- }
- printf("Hand #%d\n",cont);
- if(points<min){
- cout << "Game lost by " << min - points << " point(s).\n";
- flag=true;
- }else{
- cout << "Game won by " << points -min << " point(s).\n";
- flag=true;
- }
- cont++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement