70分,求助
出了亿点小问题
#include<bits/stdc++.h>
using namespace std;
int n,a[4][14],h[4],d[14],s;
int main()
{
cin>>n;
for(int i=1;i<=n;i++)
{
char x,c;
int y;
cin>>x>>c;
if(c=='T') y=10;
else if(c=='A') y=1;
else if(c=='J') y=11;
else if(c=='Q') y=12;
else if(c=='K') y=13;
else y=c-'0';
if(x=='S') a[0][y]++;
else if(x=='H') a[1][y]++;
else if(x=='C') a[2][y]++;
else if(x=='D') a[3][y]++;
}
for(int i=1;i<=13;i++)
{
for(int j=0;j<4;j++)
{
for(int z=0;z<4;z++)
{
if(a[j][i]==2&&a[z][i]==1&&j!=z)
{
a[j][i]=0;
a[z][i]=0;
s++;
}
if(a[j][i]==2&&a[z][i]==2&&j!=z)
{
a[j][i]=0;
a[z][i]=1;
s++;
}
}
}
}
cout<<s;
}