1035 Password (20point(s)) Easy only once

基本思想:

简单题目,有一个测试点在英文单复数上做了文章;

关键点:

无;

#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<vector> 
#include<string>
#include<math.h>
#include<algorithm>
using namespace std;
using std::vector;

struct  member{
    string id;
    string pd;
};

vector<member>vec;
bool mdf(string& s) {
    bool flag = true;
    for (int i = 0; i < s.size(); i++) {
        switch (s[i]) {
            case '1':
                s[i] = '@';
                flag = false;
                break;
            case '0':
                s[i] = '%';
                flag = false;
                break;
            case 'l':
                s[i] = 'L';
                flag = false;
                break;
            case 'O':
                s[i] = 'o';
                flag = false;
                break;
        }
    }
    return flag;
}

int main() {
    int n;
    string a, b;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        if (!mdf(b)) {
            member m;
            m.id = a;
            m.pd = b;
            vec.push_back(m);
        }
    }
    if (vec.size() == 0) {
        if(n==1)
            cout << "There is 1 account and no account is modified";
        else
            cout << "There are " << n << " accounts and no account is modified";
    }
    else {
        cout << vec.size() << endl;
        for (int i = 0; i < vec.size(); i++) {
            cout << vec[i].id << " " << vec[i].pd << endl;
        }
    }
    system("pause");
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/songlinxuan/p/12200690.html