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

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

PAT A1035. Password (20)

2019-11-11 01:17:48
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

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;}
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 曲水县| 柏乡县| 平利县| 桂平市| 十堰市| 天门市| 太仆寺旗| 五家渠市| 小金县| 连南| 卓尼县| 黄龙县| 师宗县| 达孜县| 虞城县| 临沂市| 伊金霍洛旗| 察雅县| 武隆县| 泉州市| 襄垣县| 富顺县| 泸水县| 榆社县| 文成县| 三台县| 武鸣县| 胶州市| 剑阁县| 鹤壁市| 温宿县| 江北区| 都匀市| 梓潼县| 康平县| 延长县| 比如县| 松潘县| 甘孜| 泗阳县| 简阳市|