求解
查看原帖
求解
1041395
sikunran楼主2024/11/7 21:58
#include<bits/stdc++.h>
using namespace std;
string x;
int n,ans;
bool is[100];
int h(string poker){
    int a;
    if (poker[1]>'0'&&poker[1]<='9')a=poker[1]-'0';
    else if(poker[1]=='T')a=10;
    else if(poker[1]=='J')a=11;
    else if(poker[1]=='Q')a=12;
    else if(poker[1]=='K')a=13;
    else if(poker[1]=='A')a=1;

    if(poker[0]=='D')a*=1;
    else if(poker[0]=='C')a*=2;
    else if(poker[0]=='H')a*=3;
    else if(poker[0]=='S')a*=4;

    return a;
}
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        is[h(x)]=true;
    }

    for(int i=1;i<=52;i++){
        if(is[i]==false)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

求解,按理来讲没问题啊,测试点全过。 求大佬讲解,回复帮忙@一下谢谢

2024/11/7 21:58
加载中...