美文网首页
1035 Password (20分)

1035 Password (20分)

作者: 量化啦啦啦 | 来源:发表于2020-02-13 17:55 被阅读0次
image.png
/**
Sample Input 1:
3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa
Sample Output 1:
2
Team000002 RLsp%dfa
Team000001 R@spodfa
Sample Input 2:
1
team110 abcdefg332
Sample Output 2:
There is 1 account and no account is modified
Sample Input 3:
2
team110 abcdefg222
team220 abcdefg333
Sample Output 3:
There are 2 accounts and no account is modified
 */
#include<iostream>
#include<string>
#include<vector>

using namespace std;
int N;

int main() {
    cin >> N;
    vector<string> v;
    for (int i = 0; i < N; i++) {
        string name, pwd;
        cin >> name >> pwd;
        int len = pwd.length(), flag = 0;
        for (int j = 0; j < len; j++) {
            switch (pwd[j]) {
                case '1':
                    pwd[j] = '@';
                    flag = 1;
                    break;
                case '0':
                    pwd[j] = '%';
                    flag = 1;
                    break;
                case 'l':
                    pwd[j] = 'L';
                    flag = 1;
                    break;
                case 'O':
                    pwd[j] = 'o';
                    flag = 1;
                    break;
            }
        }
        if (flag) {
            auto tmp = name + " " + pwd;
            v.push_back(tmp);
        }
    }
    int cnt = v.size();//修改过的数量
    if (cnt != 0) {//若修改过一个及以上
        printf("%d\n", cnt);
        for (int i = 0; i < cnt; i++)
            cout << v[i] << endl;
    } else if (N == 1)//没有修改过,但只有一条数据
        printf("There is 1 account and no account is modified");
    else
        printf("There are %d accounts and no account is modified", N);
    return 0;
}

相关文章

  • 1035 Password

    题目 在输密码的时候,会出现一些相似的字符。所以,要替换掉它。 替换字符替换后1@lL0%Oo 输出:1.被修改密...

  • PAT甲级1035

    1035 Password (20分)To prepare for PAT, the judge sometime...

  • 【PAT_1035】Password

    题目描述 为了准备PAT,judge有时必须为用户生成随机密码。 问题是总是有一些令人困惑的密码,因为很难区分1(...

  • 1035 Password (20 分)

    超困?这题一点都不提神qaqaqaqaq想要一张50元优惠券puts()不用\n啦 (复制粘贴?的锅 1035题目链接

  • 1035 Password (20分)

  • A1035 Password (20分)

    learn && wrong;1、逻辑又错了,这里有加数字的,一开头有加一个数字,处理就不同了,用一个数组来存并且...

  • PAT Advanced 1035. Password (20)

    我的PAT系列文章更新重心已移至Github,欢迎来看PAT题解的小伙伴请到Github Pages浏览最新内容(...

  • 【PAT A1035】 Password (20)(20 分)

    To prepare for PAT, the judge sometimes has to generate r...

  • 2019-08-27 A1035 Password

    这道题对我来说有些困难,用了很长时间(并看了柳神的代码)才解决,下面这个blog是对vector容器的各种函数的介...

  • Chapter5——数据结构——字符串

    1. 题目列表 poj1035,poj3080,poj1936 2. POJ1035——Spell checker...

网友评论

      本文标题:1035 Password (20分)

      本文链接:https://www.haomeiwen.com/subject/fkylfhtx.html