题目来源:https://ac.nowcoder.com/acm/contest/5673/G
题意:
一套牌有四种属性,每种属性都有三种特征,shapes (one, two, or three), shape (diamond, squiggle, or oval), shading (solid, striped, or open), color (red, green, or purple),如果是*,可以选任意一种。给出n套牌,每套牌给出[<number>][<shape>][<shading>][<color>],问有没有三张牌符合同一属性的特征要么全都相同,要么全都不同。
解题思路:
其实是这输出还有英文有点卡住了,按照顺序输入,再预处理,这里用了一个容器,使得存储变得方便起来,然后三重for循环遍历就可以了。</color></shading></shape></number>

#include<bits/stdc++.h>
using namespace std;
map<string,int>p;//容器 
int a[10010][10];

int main()
{
    int t;
    int tt=1;
    cin>>t; 
    p["*"]=0;
    p["one"]=1;
    p["two"]=2;
    p["three"]=3;
    p["diamond"]=1;
    p["squiggle"]=2;
    p["oval"]=3;
    p["solid"]=1;
    p["striped"]=2;
    p["open"]=3;
    p["red"]=1;
    p["green"]=2;
    p["purple"]=3;
    while(t--)
    {
        int n;
        cin>>n;
        string s;
        for(int i=0;i<n;i++)
        {
            cin>>s;
            string ss;
            int cnt=0;
            for(int j=0;j<s.size();j++)
            {
                if(s[j]=='[') ss="",cnt++;
                else if(s[j]==']') 
                a[i+1][cnt]=p[ss];
                else ss+=s[j];
            }
        }
        cout<<"Case #"<<tt++<<": ";
        int find1=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=i+1;j<=n;j++)
            {
                for(int k=j+1;k<=n;k++)
                {
                    int g=0;
                    for(int l=1;l<=4;l++)
                    {
                        if(a[i][l]==0||a[j][l]==0||a[k][l]==0) continue;
                        if(a[i][l]==a[j][l]&&a[i][l]==a[k][l]) continue;
                        if(a[i][l]!=a[k][l]&&a[i][l]!=a[j][l]&&a[j][l]!=a[k][l]) continue;
                        g=1;
                        break;
                    }
                        if(!g)
                    {
                        cout<<i<<' '<<j<<' '<<k<<endl;
                        find1=1;
                    }
                    if(find1) break;
                }
                if(find1) break;
            }
            if(find1) break;
        }
        if(!find1)
         cout<<-1<<endl;
    }
    return 0;
}