国产探花免费观看_亚洲丰满少妇自慰呻吟_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;}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 五寨县| 务川| 永城市| 中西区| 大邑县| 滦南县| 新巴尔虎右旗| 武定县| 鄂尔多斯市| 乐昌市| 钦州市| 灵石县| 沁源县| 西宁市| 郧西县| 秦皇岛市| 西昌市| 尼勒克县| 自治县| 常熟市| 阜城县| 阜阳市| 滦平县| 巩义市| 马龙县| 彭阳县| 洪洞县| 响水县| 嘉定区| 北票市| 游戏| 墨脱县| 团风县| 奉贤区| 息烽县| 杨浦区| 鄂托克前旗| 嘉鱼县| 林州市| 平湖市| 依兰县|