很适合用结构体数组的一道题

#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;struct info{char usr[11]="";char pwd[11]="";bool changed = false;
}infos[1010];int main(){int n,lenPwd;int hasChanged = 0;scanf("%d",&n);for(int i=0;i<n;i++){scanf("%s %s",&infos[i].usr,&infos[i].pwd);lenPwd = strlen(infos[i].pwd);for(int j=0;j<lenPwd;j++){if(infos[i].pwd[j] == '1'){infos[i].pwd[j]='@';infos[i].changed = true;}if(infos[i].pwd[j] == '0'){infos[i].pwd[j]='%';infos[i].changed = true;}if(infos[i].pwd[j] == 'l'){infos[i].pwd[j]='L';infos[i].changed = true;}if(infos[i].pwd[j] == 'O'){infos[i].pwd[j]='o';infos[i].changed = true;}}if(infos[i].changed)hasChanged ++;}if(hasChanged){printf("%d\n",hasChanged);}else{if(n == 1)printf("There is 1 account and no account is modified\n");if(n != 1)printf("There are %d accounts and no account is modified",n);}for(int i=0;i<n;i++){if(infos[i].changed)printf("%s %s\n",infos[i].usr,infos[i].pwd);}return 0;
}

1035 Password相关推荐

  1. PAT甲级1035 Password:[C++题解]字符串修改

    文章目录 题目分析 题目链接 题目分析 题目重述: 题目分析: 把需要更改的字母和对应的字母分别存在string中,两者下标索引要对应. 采用 vector来存储< string, string ...

  2. 1035 Password (20 分)

    1035 Password (20 分) 题目大意 给定n个用户的姓名和密码,把密码中的1改为@,0改为%,l改为L,O改为o 如果不存在需要修改的密码,则输出There are n accounts ...

  3. PAT甲级1035 Password

    题目 1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords for ...

  4. 【测试点分析】1035 Password (20 分)

    立志用最少的代码做最高效的表达 PAT甲级最优题解-->传送门 To prepare for PAT, the judge sometimes has to generate random pa ...

  5. 【PAT甲级 替换指定字符】1035 Password (20 分) Java版 4/4通过

    题目 这个题挺简单,意思就是把所有的1替换成@,0替换成%等等 读题要仔细,输出格式方面有几个小坑: 末尾不要有多余的空格.换行 如果替换了,要在第一行输出替换的条数 如果没替换,要把题目给的字符串拼 ...

  6. PAT (Advanced Level) 1035. Password (20)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

  7. pat1035. Password (20)

    1035. Password (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare f ...

  8. PAT日志 1035

    顽强的小白 1035 Password (20 分) To prepare for PAT, the judge sometimes has to generate random passwords ...

  9. PAT甲级题目翻译+答案 AcWing(字符串处理)

    1001 A+B Format (20 分) 题意 :将整数转换成标准格式 思路 :从后往前遍历字符串进行模拟,每三个数字加一个逗号,但不能是在最前面加逗号,也不能是加在负号后面 #include & ...

最新文章

  1. 《javascript语言精粹》读书笔记(一)
  2. GRE核心词汇助记与精练-List9切分、部分
  3. 从喧闹与富有中搞懂搜索和拓扑
  4. 怎么自定义linux登录界面?
  5. C中的危险函数(缓冲区溢出)
  6. Win10安装华三模拟器各种疑难问题
  7. docker应用,后端服务出现OOM情况排查
  8. 如何在 SAP 电商云 Spartacus UI 首页的产品展示里显示视频
  9. oracle删除本地文件权限,使用 UNIX 权限保护文件
  10. 一般程序员 vs 优秀程序员,没有对比就没有伤害
  11. android 高质量游戏,你玩过几款?2013年度十大安卓热门游戏大盘点
  12. [K8S]kubeadm国内镜像安装方式
  13. 下载mrt需要java_MRT Lab | 下载
  14. Ubuntu Server 如何校对时钟(通过NTP)
  15. logistic映射图像加密matlab,基于Logistic映射与排序变换的图像加密算法
  16. 京东联盟接口——链接取商品sku
  17. python程序员工资待遇-为什么企业很难招聘到好的python程序员?
  18. 新品流量 DRS动态评分 店铺层级 搜索权重 增加流量 保持流量持续上升的技巧
  19. 2021有什么好的入耳式耳机推荐?耳机热销性价比牌子排行榜单推荐!
  20. JavaScript实现语音助手核心代码

热门文章

  1. iOS infoplist 权限设置
  2. ABP理论学习之数据传输对象(DTO)
  3. Codeforces Round #270
  4. 第七篇:数据预处理(四) - 数据归约(PCA/EFA为例)
  5. Quick Cocos2dx 初步战斗
  6. 用jarsigner对android apk进行签名
  7. 理解NSAttributedString
  8. (原创)JAVA注解应用——实现属性的自动检测
  9. tar、gzip、gunzip、bzip2、zip、unzip
  10. 随机存取:fseek(),ftell()