CF A题求调
  • 板块学术版
  • 楼主川寰boy
  • 当前回复22
  • 已保存回复22
  • 发布时间2022/8/31 01:21
  • 上次更新2023/10/27 13:00:39
查看原帖
CF A题求调
566168
川寰boy楼主2022/8/31 01:21

就很无脑,整了四次不过,B题口胡一次切

#include<iostream>
#include<string>
#include<map>
using namespace std;
bool judge(char a)
{
    if(a=='T'||a=='u'||a=='i'||a=='m'||a=='r')
    return 1;
    return 0;
}
int main()
{
    map<char,int>m;
    m['T']=1;
    m['u']=1;
    m['i']=1;
    m['r']=1;
    m['m']=1;
    int t,n,i,j;
    bool flag=0;
    char s[10];
    cin>>t;
    for(i=0;i<t;i++)
    {
        cin>>n;
        cin>>s;
        if(n!=5)
        {
            cout<<"NO"<<endl;
            continue;
        }
        for(j=0;j<5;j++)
        {
            if(judge(s[j])&&(m[s[j]]==1))
            {
                // cout<<s[j]<<' ';
                m[s[j]]=0;
            }
            else
            {
                flag=1;
                break;
            }
        }
        // cout<<endl;
        // cout<<flag<<endl;
        if(flag==1)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            cout<<"YES"<<endl;
        }
        flag=0;
    }
    return 0;
}
2022/8/31 01:21
加载中...