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特别不喜欢那些随便转载别人的原创文章又不给 ...
随机推荐
- windows中使用git和开源中国
现学现卖,学了忘忘了学. 非常感谢OSC提供了这么好的一个国内的免费的git托管平台.这里简单说下TortoiseGit操作的流程.很傻瓜了首先你要准备两个软件,分别是msysgit和tortoise ...
- JQuery 学习笔记-2017.05.22
JQuery jQuery 是一个 JavaScript 函数库. jQuery 库包含以下特性: HTML 元素选取 HTML 元素操作 CSS 操作 HTML 事件函数 JavaScript 特效 ...
- sourceTree跳过注册
sourceTree是一个很方便的git管理工具,但是现在一直无法注册,本文记录了跳过注册的方法. 将下面的代码赋值到地址栏 %LocalAppData%\Atlassian\SourceTree\ ...
- iptables设置规则
iptables -A INPUT -s 127.0.0.1 -p tcp --dport 8080 -j ACCEPT 添加到最后一条iptables -I INPUT -p tcp --dpor ...
- JFreeChart框架中生成饼状图上怎样显示数据 [问题点数:40分,结帖人GreenLawn]
我用JFreeChart框架生成饼状图,但想把数据信息在饼图上显示,是在饼图内部(即圆内)显示!怎样实现啊?? 去掉lablepieplot.setLabelGenerator(null);去掉线p ...
- 【webGL】
1.类型化数组 WebGL设计复杂的计算,需要提前知道数值的精度,而标准的javascript数值无法满足需要.WebGL引入了一个概念,叫类型化数组. ArrayBuffer的类型,表示的只是内存中 ...
- 青岛大学开源OJ平台搭建
源码地址为:https://github.com/QingdaoU/OnlineJudge 可参考的文档为:https://github.com/QingdaoU/OnlineJudgeDeploy/ ...
- OpenCV——ROI截取、线性混合、通道分离、合并、亮度对比度调整
#include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace st ...
- 服务器端数据合法性验证:签名sign和口令token原理
有时候,你也许会想: 我写的接口,那别人要是知道url,并且知道其需要的数据结构和逻辑,那不是都可以访问了? 甚至是,客户点传递过来的数据,是不是被恶意修改了? 这时,我们可能需要“验证”一下.比如: ...
- 【本地服务器】用nginx进行反向代理处理(windows)
在通过json-server搭建本地服务器得到 http://localhost:3000/todos 的基础上,要想将接口改为www.test.com/todos这样的形式 ,则需要用nginx ...