1035 Password (20 分)

水题~。

map<char,char> mp;
int n;

void init()
{
    mp['1']='@';
    mp['0']='%';
    mp['l']='L';
    mp['O']='o';
}

int main()
{
    init();

    cin>>n;

    vector<pair<string,string>> res;
    for(int i=0;i<n;i++)
    {
        string id,password;
        cin>>id>>password;

        bool ok=false;
        for(int j=0;j<password.size();j++)
            if(mp.count(password[j]))
            {
                ok=true;
                password[j]=mp[password[j]];
            }
        if(ok) res.pb({id,password});
    }

    if(res.size() == 0)
    {
        if(n > 1)
            printf("There are %d accounts and no account is modified
",n);
        else puts("There is 1 account and no account is modified");
    }
    else
    {
        cout<<res.size()<<endl;
        for(int i=0;i<res.size();i++)
            cout<<res[i].fi<<' '<<res[i].se<<endl;
    }
    //system("pause");
    return 0;
}
原文地址:https://www.cnblogs.com/fxh0707/p/14401540.html