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

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

PAT A1035. Password (20)

2019-11-11 01:17:44
字體:
來源:轉載
供稿:網友

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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 邮箱| 孝昌县| 盱眙县| 马鞍山市| 德化县| 阿图什市| 岳池县| 甘孜| 务川| 田林县| 忻城县| 涟源市| 五大连池市| 清镇市| 龙门县| 吴桥县| 吉水县| 洛川县| 安乡县| 门源| 枣庄市| 永寿县| 九江县| 礼泉县| 甘肃省| 上虞市| 永川市| 肃北| 和田市| 龙游县| 桦南县| 莱芜市| 台江县| 宕昌县| 临潭县| 安义县| 呼图壁县| 安陆市| 清原| 南陵县| 鲁甸县|