小y的考试

分析

模拟就好了,求出长度最长的选项和长度最短的选项,然后在求出四个选项中比他们短的,比他们长的分别有多少个,判断即可

代码

//#pragma GCC optimize(3,"inline","Ofast","fast-math","no-stack-protector","unroll-loops")
//#pragma GCC target("sse","sse2","sse3","sse4","avx","avx2","popcnt")

/*
(写点什么吧...)
*/
#include<bits/stdc++.h>

#define R register
#define ll long long
#define inf INT_MAX

using namespace std;

const int N=1100;

int len[5];
char a[N],b[N],c[N],d[N],cho[5]={'0','A','B','C','D'};

int main()
{
    int T;scanf("%d",&T);
    while(T--)
    {
        scanf("%s%s%s%s",a,b,c,d);
        len[1]=strlen(a);
        len[2]=strlen(b);
        len[3]=strlen(c);
        len[4]=strlen(d);

        int x=1,y=1;
        for (int i=2;i<=4;i++)
        {
            if(len[i]>len[x]) x=i;
            if(len[i]<len[y]) y=i;
        }

        int num=0;
        for (int i=1;i<=4;i++)
            if(len[i]>len[y]) num++;
        if(num==3)
        {
            putchar(cho[y]);puts("");
            continue;
        }

        num=0;
        for (int i=1;i<=4;i++)
            if(len[x]>len[i]) num++;
        if(num==3)
        {
            putchar(cho[x]);puts("");
            continue;
        }

        puts("C");
    }

    return 0;
}