Easy
2025-07-22 19:34:00
发布于:上海
13阅读
0回复
0点赞
用桶,很简单:
#include <iostream>
#include <string>
using namespace std;
int main (){
int n;
cin>>n;
string temp;
int a=0;
int x[53]={0};
for(int i = 1;i<=n;i++){
cin>>temp;
if(temp[0]=='C') a+=1;
else if(temp[0]=='H') a+=2;
else if(temp[0]=='D') a+=3;
else if(temp[0]=='S') a+=0;
if('1'<=temp[1] && temp[1]<='9') a+=4*(temp[1]-'0')-3;
else if(temp[1] == 'T') a+=37;
else if(temp[1] == 'J') a+=41;
else if(temp[1] == 'Q') a+=45;
else if(temp[1] == 'K') a+=49;
else if(temp[1] == 'A') a+=1;
x[a]++;
a=0;
}
int sum=0;
for(int i = 1;i<=52;i++){
if(x[i]==0){
sum++;
}
}
cout<<sum;
return 0;
}
这里空空如也
有帮助,赞一个