PAT甲题题解-1035. Password (20)-水
题意:
给n个用户名和密码,把密码中的1改为@,0改为%,l改为L,O改为o。
让你输出需要修改密码的用户名个数,以及对应的用户名和密码,按输入的顺序。
如果没有用户需要修改,则输出对应的语句,注意单复数。。。
没啥好说的,就for一遍密码,把需要改的改下,存入到ans中去。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
#include <cmath>
using namespace std;
const int maxn=+;
struct Node{
char team[];
char pass[];
}ans[maxn];
int main()
{
int n;
int cnt=;
char team[],pass[];
scanf("%d",&n);
bool flag;
for(int i=;i<n;i++){
scanf("%s %s",team,pass);
flag=true;
int len=strlen(pass);
for(int j=;j<len;j++){
//printf("%c\n",pass[j]);
if(pass[j]==''){
//printf("1->@\n");
flag=false;
pass[j]='@';
}
else if(pass[j]==''){
//printf("0->\%\n");
flag=false;
pass[j]='%';
}
else if(pass[j]=='l'){
//printf("l->L\n");
flag=false;
pass[j]='L';
}
else if(pass[j]=='O'){
//printf("O->o\n");
flag=false;
pass[j]='o';
}
}
if(!flag){
strcpy(ans[cnt].team,team);
strcpy(ans[cnt].pass,pass);
cnt++;
}
}
if(cnt==){
if(n==)
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",cnt);
for(int i=;i<cnt;i++){
printf("%s %s\n",ans[i].team,ans[i].pass);
}
}
return ;
}
PAT甲题题解-1035. Password (20)-水的更多相关文章
- PAT甲题题解-1008. Elevator (20)-大么个大水题,这也太小瞧我们做题者的智商了
如题... #include <iostream> #include <cstdio> #include <algorithm> #include <cstr ...
- PAT甲题题解-1061. Dating (20)-字符串处理,水水
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...
- PAT甲题题解-1077. Kuchiguse (20)-找相同后缀
#include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...
- PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642
PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...
- PAT甲题题解-1011. World Cup Betting (20)-误导人的水题。。。
题目不严谨啊啊啊啊式子算出来结果是37.975样例输出的是37.98我以为是四舍五入的啊啊啊,所以最后输出的是sum+0.005结果告诉我全部错误啊结果直接保留两位小数就可以了啊啊啊啊 水题也不要这么 ...
- PAT甲题题解-1019. General Palindromic Number (20)-又是水题一枚
n转化为b进制的格式,问你该格式是否为回文数字(即正着写和倒着写一样)输出Yes或者No并且输出该格式又是水题... #include <iostream> #include <cs ...
- PAT甲题题解-1041. Be Unique (20)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789189.html特别不喜欢那些随便转载别人的原创文章又不给 ...
- PAT甲题题解-1050. String Subtraction (20)-水题
#include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...
- PAT甲题题解-1120. Friend Numbers (20)-水题
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789775.html特别不喜欢那些随便转载别人的原创文章又不给 ...
随机推荐
- 0基础的人如何入门 Python ?Python难么?
人生苦短,我用Python,为啥这么说,因为我们自动化测试有金句:学完Python,便可上天 ~ 废话不多说,相信很多人都听过之前的Python进入小学课本.Python进入浙江省高考等新闻,有这么多 ...
- Alpha冲刺报告(4/12)(麻瓜制造者)
今日完成的情况 江郑: 今天对数据库的需求部分进行了完善 邓弘立: 完成了首页界面UI 刘双玉: 基本完成商品信息发布接口 汪志彬: 尝试UI的设计 符天愉: 将登录接口部署到服务器上,结果Linux ...
- BZOJ4340:[BJOI2015]隐身术(后缀数组,ST表,DFS)
Description 给定两个串A,B.请问B中有多少个非空子串和A的编辑距离不超过K? 所谓“子串”,指的是B中连续的一段.不同位置的内容相同的子串算作多个. 两个串之间的“编辑距离”指的是把一个 ...
- Guava 的EventBus示例代码(简单笔记,后期补充)
package guavademo.event.bus; import com.google.common.eventbus.EventBus; import com.google.common.ev ...
- 利用存储过程来重命名SQL Server数据库
最近遇到一个需要在多用户模式下重新命名数据库的Case, 因为数据库可能被其他用户使用,所以直接修改可能会失败.对于此种情况,我们可以等所有用户结束使用数据库时修改,或者是将数据库切换到单用户模式下进 ...
- input全选与单选(把相应的value放入隐藏域去)
框架是Jquery 需求是: 页面上有很多复选框,1.当我选择一项复选框时候 把对应的值放入到隐藏域去 2.当我反选的时候 把隐藏域对应的值删掉.3.当我全选的时候 页面上所有的选择框的值一起放到隐藏 ...
- Python2.7-hashlib
hashlib模块,实现了支持多种不同哈希算法的接口,不同 hash 算法的构造函数就是算法名,返回的哈希对象都具有相同接口.哈希算法不是加密算法,所以下面提到的加密不是真的加密,因为真的加密需要能够 ...
- 解决IDEA因分配内存而引起的卡顿
解决IDEA分配内存不足引起卡顿的问题 在使用IDEA的过程中,经常会运行一段时间后程序卡顿.一段代码可能要敲很久或者出现死机状态,严重影响代码书写速度.经查阅资料,IDEA的自动分配内存最大只有75 ...
- char a='1'和char a=1区别
char a='1'表示:把字符为1,ASSIC码为49的值赋值给a: char a= 1表示:把ASSIC码为1的值赋值给a
- day75
昨日回顾: 1 inclusion_tag -干什么用的?生成html的片段(动态,传参数,传数据) -app下新建一个模块,templatetags -创建一个py文件(mytag.p ...