1035. Password
来源:互联网 发布:禁止用户安装软件 编辑:程序博客网 时间:2024/06/03 23:38
http://pat.zju.edu.cn/contests/pat-a-practise/1035
//字符串转换,输出 使用c++下的string类,此时不能用c的scanf。printf。。
switch case 语句的使用,vector容器的使用
输出的字符串要仔细比对,看细节,there is 与 there are 不同...
#include <iostream>#include <string>#include <vector>using namespace std;struct STU { string account; string password;};STU stu[1001];vector<STU> ans;int main(){ int n,i,j; cin>>n; for (i=1;i<=n;i++) { cin>>stu[i].account; cin>>stu[i].password; } for (i=1;i<=n;i++) { bool change=false; int lp=stu[i].password.size(); for (j=0;j<lp;j++) { switch(stu[i].password[j]) { case '1': stu[i].password[j]='@'; change=true; break; case '0': stu[i].password[j]='%'; change=true; break; case 'l': stu[i].password[j]='L'; change=true; break; case 'O': stu[i].password[j]='o'; change=true; break; default: break; } } if (change) { ans.push_back(stu[i]); } } if (ans.size()==0) { if (n==1) { cout<<"There is 1 account and no account is modified"<<endl; } else cout<<"There are "<<n<<" "<<"accounts and no account is modified"<<endl; } else cout<<ans.size()<<endl; for (i=0;i<ans.size();i++) { cout<<ans[i].account<<" "<<ans[i].password<<endl; } return 0;}
- 1035. Password
- 1035. Password
- 1035. Password
- 1035. Password
- 1035.Password
- 1035. Password
- 1035. Password
- 1035. Password
- 1035. Password (20)
- 【PAT】1035. Password (20)
- 1035. Password (20)-PAT
- 1035. Password (20)
- 1035. Password (20)
- 1035. Password (20)
- PAT 1035. Password (20)
- PAT 1035. Password
- 1035. Password (20)
- 1035. Password (20)
- C#多线程学习(五) 多线程的自动管理(定时器)
- 防火墙的接口特性
- 使用C#和Excel进行报表开发(二)-操作统计图(Chart)
- 数据结构实验3---二叉树的遍历(递归、非递归)
- 关于tomcat5.5不能用ip地址访问的问题
- 1035. Password
- ExtJs基础UI设计进阶教程(1)
- 晒一个基于SQLite的WPF练习的小作品——具备一定的知识资料、任务、联系人管理功能
- 使用C#和Excel进行报表开发(三)-生成统计图(Chart)1
- 数据库性能优化详解
- C++和C语言的一点区别
- I2C总线原理
- C#多线程学习(六) 互斥对象
- 使用C#和Excel进行报表开发(三)-生成统计图(Chart)2