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

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

PAT A1035. Password (20)

2019-11-11 02:30:03
字體:
來源:轉載
供稿:網友

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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 陇西县| 罗江县| 永仁县| 县级市| 武平县| 共和县| 乌拉特中旗| 蚌埠市| 靖州| 彩票| 遵化市| 东乡| 鹿邑县| 长阳| 讷河市| 长顺县| 自贡市| 繁峙县| 游戏| 准格尔旗| 临颍县| 滁州市| 镇康县| 神农架林区| 南漳县| 高碑店市| 海宁市| 乌恰县| 湘潭市| 从江县| 巴林右旗| 湘阴县| 获嘉县| 延长县| 英吉沙县| 怀仁县| 眉山市| 长丰县| 罗平县| 东城区| 凤台县|