首页 > 学院 > 开发设计 > 正文

1035. Password 解析

2019-11-09 19:27:39
字体:
来源:转载
供稿:网友

注意 is 和 are 注意 account 和accounts!!!

注意 is 和 are 注意 account 和accounts!!!

注意 is 和 are 注意 account 和accounts!!!

#include <iostream>#include <string>#include <vector>#define MAX 1010using namespace std;bool Convert(string & s) {	bool tag = false;	for (int i = 0; i < s.size(); i++) {		switch (s[i]) {		case '1':s[i] = '@', tag = true; break;		case 'l':s[i] = 'L', tag = true; break;		case 'O':s[i] = 'o', tag = true; break;		case '0':s[i] = '%', tag = true; break;		}	}	return tag;}struct User{	string name;	string passWord;};User list[MAX];vector <bool> isChange;int Count = 0;int main() {	int N;	cin >> N;	isChange.resize(N,false);	bool tag = false;	for (int i = 0; i < N; i++) {		cin >> list[i].name >> list[i].password;		isChange[i] = Convert(list[i].password);		if (isChange[i]) {			Count++;			tag = true;		}	}		if (!tag) {		if(N == 1)			cout << "There is " << N << " account and no account is modified" << endl;		else 			cout << "There are " << N << " accounts and no account is modified" << endl;	}	else {		cout << Count << endl;		for (int i = 0; i < N; i++) {			if (isChange[i]) {				cout << list[i].name << " " << list[i].password << endl;			}		}	}	system("pause");	return 0;}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表