国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

PAT A1035. Password (20)

2019-11-11 00:55:08
字體:
來源:轉載
供稿:網友

To PRepare for PAT, the judge sometimes has to generate random passWords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase). One solution is to replace 1 (one) by @, 0 (zero) by %, l by L, and O by o. Now it is your job to write a program to check the accounts generated by the judge, and to help the juge modify the confusing passwords.

Input Specification:

Each input file contains one test case. Each case contains a positive integer N (<= 1000), followed by N lines of accounts. Each account consists of a user name and a password, both are strings of no more than 10 characters with no space.

Output Specification:

For each test case, first print the number M of accounts that have been modified, then print in the following M lines the modified accounts info, that is, the user names and the corresponding modified passwords. The accounts must be printed in the same order as they are read in. If no account is modified, print in one line "There are N accounts and no account is modified" where N is the total number of accounts. However, if N is one, you must print "There is 1 account and no account is modified" instead.

Sample Input 1:

3Team000002 Rlsp0dfaTeam000003 perfectpwdTeam000001 R1spOdfaSample Output 1:
2Team000002 RLsp%dfaTeam000001 R@spodfaSample Input 2:
1team110 abcdefg332Sample Output 2:
There is 1 account and no account is modifiedSample Input 3:
2team110 abcdefg222team220 abcdefg333Sample Output 3:
There are 2 accounts and no account is modified
#include <cstdio>#include <algorithm>#include <cmath>#include <cstring>#define Max 100001using namespace std;struct user{	char name[11];	char pas[11];}a[Max],b[Max];int main(){	int n,k=0;	scanf("%d",&n);	for(int i=0;i<n;i++)	{		int flag=0;		scanf("%s %s",a[i].name,a[i].pas);		for(int j=0;j<strlen(a[i].pas);j++)		{			if(a[i].pas[j]=='1')			{				a[i].pas[j]='@';				flag++;			}			else if(a[i].pas[j]=='0')			{				a[i].pas[j]='%';				flag++;			}			else if(a[i].pas[j]=='l')			{				a[i].pas[j]='L';				flag++;			}			else if(a[i].pas[j]=='O')			{				a[i].pas[j]='o';				flag++;			}		}		if(flag!=0)		{			for(int j=0;j<strlen(a[i].pas);j++)			{				b[k].pas[j]=a[i].pas[j];			}			for(int j=0;j<strlen(a[i].name);j++)			{				b[k].name[j]=a[i].name[j];			}			k++;		}	}	if(k==0) {		if(n==1) printf("There is %d account and no account is modified/n",n);		else printf("There are %d accounts and no account is modified/n",n);	}	else {		printf("%d/n",k);		for(int i=0;i<k;i++)  printf("%s %s/n",b[i].name,b[i].pas);	}	system("pause");	return 0;}
上一篇:go crontab

下一篇:leetcode-Hamming Distance

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 吉隆县| 育儿| 澄城县| 鹰潭市| 泗水县| 宜黄县| 湘西| 海兴县| 鹤庆县| 治多县| 琼海市| 保亭| 合山市| 昌黎县| 日喀则市| 平潭县| 会昌县| 远安县| 皮山县| 建宁县| 赤峰市| 清水河县| 饶阳县| 依安县| 宜宾市| 婺源县| 万源市| 探索| 江城| 延川县| 陇川县| 松江区| 永福县| 陇西县| 瑞丽市| 交口县| 华蓥市| 东乡族自治县| 兰坪| 三江| 永川市|