A1035. Password
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:
3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa
Sample Output 1:
2
Team000002 RLsp%dfa
Team000001 R@spodfa
Sample Input 2:
1
team110 abcdefg332
Sample Output 2:
There is 1 account and no account is modified
Sample Input 3:
2
team110 abcdefg222
team220 abcdefg333
Sample Output 3:
There are 2 accounts and no account is modified
#include<cstdio>
#include<iostream>
using namespace std;
int main(){
int N, modfi[] = {}, count = ;
char acc[][], pwd[][];
scanf("%d", &N);
for(int i = ; i < N; i++){
scanf("%s%s",acc[i], pwd[i]);
for(int j = ; pwd[i][j] != '\0'; j++){
if(pwd[i][j] == ''){
pwd[i][j] = '@';
modfi[i] = ;
}else if(pwd[i][j] == ''){
pwd[i][j] = '%';
modfi[i] = ;
}else if(pwd[i][j] == 'l'){
pwd[i][j] = 'L';
modfi[i] = ;
}else if(pwd[i][j] == 'O'){
pwd[i][j] = 'o';
modfi[i] = ;
}
}
if(modfi[i] == )
count++;
}
if(count == ){
if(N == )
printf("There is 1 account and no account is modified");
else
printf("There are %d accounts and no account is modified", N);
}else{
printf("%d", count);
for(int i = ; i < N; i++)
if(modfi[i] == )
printf("\n%s %s", acc[i], pwd[i]);
}
cin >> N;
return ;
}
A1035. Password的更多相关文章
- A1035 Password (20)(20 分)
A1035 Password (20)(20 分) To prepare for PAT, the judge sometimes has to generate random passwords f ...
- PAT甲级——A1035 Password
To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem ...
- PAT A1035 Password
题目描述: To prepare for PAT, the judge sometimes has to generate random passwords for the users. The pr ...
- PAT A1035 Password (20)
AC代码 注意创造函数条件中使用引用 输出语句注意单复数 #include <cstdio> #include <cstring> #include <iostream& ...
- PAT/字符串处理习题集(二)
B1024. 科学计数法 (20) Description: 科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+-][1-9]"."[0-9]+E[+ ...
- PAT题目AC汇总(待补全)
题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...
- 1035 Password (20 分)
1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for th ...
- 打开程序总是会提示“Enter password to unlock your login keyring” ,如何成功关掉?
p { margin-bottom: 0.1in; line-height: 120% } 一.一开始我是按照网友所说的 : rm -f ~/.gnome2/keyrings/login.keyrin ...
- your password has expired.to log in you must change it
今天应用挂了,log提示密码过期.客户端连接不上. 打开mysql,执行sql语句提示密码过期 执行set password=new password('123456'); 提示成功,但客户端仍然连接 ...
随机推荐
- item 11: 比起private undefined function优先使用deleted function
本文翻译自modern effective C++,由于水平有限,故无法保证翻译完全正确,欢迎指出错误.谢谢! 博客已经迁移到这里啦 如果你为其他开发者提供代码,并且你想阻止他们调用一个特定的函数,你 ...
- 常见 Bash 内置变量介绍
目录 $0$1, $2 等等$#$* 与 "$*"$@ 与 "$@"$!$_$$$PPID$?$BASH$BASH_VERSION$EUID 与 $UID$GR ...
- Jenkins持续集成构建自动化测试项目
1.配置内容安全策略(配置一次): 1.1.构建一个自由风格的软件项目 1.2.Build Triggers:Build when job nodes start 1.3.Build:Execute ...
- Tomcat利用MSM实现Session共享方案解说
Session共享有多种解决方法,常用的有四种:1)客户端Cookie保存2)服务器间Session同步3)使用集群管理Session(如MSM) 4)把Session持久化到数据库 针对上面Sess ...
- kvm虚拟化管理平台WebVirtMgr部署-完整记录(3)
继下面三篇文章完成了kvm虚拟化管理平台webvirtmgr环境的部署安装:kvm虚拟化管理平台WebVirtMgr部署-虚拟化环境安装-完整记录(0)kvm虚拟化管理平台WebVirtMgr部署-完 ...
- Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)-D- Array Restoration
我们知道不满足的肯定是两边大中间小的,这样就用RMQ查询两个相同等值的区间内部最小值即可,注意边界条件 #include<bits/stdc++.h> #define x first #d ...
- Mooc总结——Linux内核分析
朱荟潼+ 原创作品转载请注明出处 :<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 学习笔记链接汇总 第 ...
- ECharts设置y轴显示
参考地址:https://www.w3cschool.cn/echarts_tutorial/echarts_tutorial-no3h2cul.html yAxis: { type: 'value' ...
- shell脚本--内容查找之grep命令
grep命令可以检索文件中包含关键字(可以使用正则)的行,默认区分大小写. ubuntu@ubuntu:~/test$ cat test.txt this is linux this is Linux ...
- [Wiki].NET框架
.NET框架 建议将.NET Framework 3.0并入本条目或章节.(讨论) .NET框架 .NET框架的组件堆栈 开发者 Microsoft 初始版本 2002年2月13日,16年前 稳定 ...