1345. 序号命名【难度: 简单 / 模拟 字符串】

1345. 序号命名【难度: 简单 / 模拟 字符串】
https://www.acwing.com/problem/content/1347/

#include<bits/stdc++.h>
using namespace std;
string s,ss,a;
vector<string>ve;
string hush[10]={"","","ABC","DEF","GHI","JKL","MNO","PRS","TUV","WXY"};
int main(void)
{
    cin>>s;
    while(cin>>a)
    {
        bool flag=1;
        if(a.size()!=s.size()) continue;
        for(int i=0;i<a.size();i++) 
            if(hush[s[i]-'0'].find(a[i])==-1) {flag=0;break;}
        if(flag) ve.push_back(a);
    }
    sort(ve.begin(),ve.end());
    for(int i=0;i<ve.size();i++) cout<<ve[i]<<endl;
    if(!ve.size()) puts("NONE");
    return 0;
}
上一篇:Proxmox VE(PVE)安装教程


下一篇:潘多拉 STM32L475 VE——开发板学习 (持续更新)