题意:
给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)-水的更多相关文章

  1. PAT甲题题解-1008. Elevator (20)-大么个大水题,这也太小瞧我们做题者的智商了

    如题... #include <iostream> #include <cstdio> #include <algorithm> #include <cstr ...

  2. PAT甲题题解-1061. Dating (20)-字符串处理,水水

    #include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...

  3. PAT甲题题解-1077. Kuchiguse (20)-找相同后缀

    #include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...

  4. PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642

    PAT (Advanced Level) Practice 1035 Password (20 分) 凌宸1642 题目描述: To prepare for PAT, the judge someti ...

  5. PAT甲题题解-1011. World Cup Betting (20)-误导人的水题。。。

    题目不严谨啊啊啊啊式子算出来结果是37.975样例输出的是37.98我以为是四舍五入的啊啊啊,所以最后输出的是sum+0.005结果告诉我全部错误啊结果直接保留两位小数就可以了啊啊啊啊 水题也不要这么 ...

  6. PAT甲题题解-1019. General Palindromic Number (20)-又是水题一枚

    n转化为b进制的格式,问你该格式是否为回文数字(即正着写和倒着写一样)输出Yes或者No并且输出该格式又是水题... #include <iostream> #include <cs ...

  7. PAT甲题题解-1041. Be Unique (20)-水题

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789189.html特别不喜欢那些随便转载别人的原创文章又不给 ...

  8. PAT甲题题解-1050. String Subtraction (20)-水题

    #include <iostream> #include <cstdio> #include <string.h> #include <algorithm&g ...

  9. PAT甲题题解-1120. Friend Numbers (20)-水题

    博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6789775.html特别不喜欢那些随便转载别人的原创文章又不给 ...

随机推荐

  1. [BZOJ 3652]大新闻

    [BZOJ 3652] 大新闻 题意 随机从 \([0,n)\) 中选取一个整数 \(x\), 并从 \([0,n)\) 中再选取一个整数 \(y\). 有 \(p\) 的概率选取一个能令 \(x\o ...

  2. Java多线程学习笔记之一线程基础

    1.进程与线程 1.1 进程:是正在运行中的程序的实例,一个运行中idea就是一个进程.进程有它自己的地址空间,一般情况下,包括文本区域(text region).数据区域(data region)和 ...

  3. JS内置对象-String对象、Date日期对象、Array数组对象、Math对象

    一.JavaScript中的所有事物都是对象:字符串.数组.数值.函数... 1.每个对象带有属性和方法 JavaScript允许自定义对象 2.自定义对象 a.定义并创建对象实例 b.使用函数来定义 ...

  4. PHP+Hadoop+Hive+Thrift+Mysql实现数据统计分析

    原址:http://www.cnblogs.com/wicub/p/6094045.html   安装 Hadoop安装: http://www.powerxing.com/install-hadoo ...

  5. php 基于redis计数器类

    本文引自网络 Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API. 本文将使用其incr(自增),get(获取), ...

  6. CentOS7下账号与用户

    /etc/passwd用户记录文件,文件记录着ID和账号与一般身份用户的对应关系 用户至少会有2个ID,用户ID(UserID简UID)和用户组ID(GroupID简GID). /etc/group用 ...

  7. day 30

    今日内容: 单例模式的四种方法 网络编程的介绍 单例模式: 什么是单例模式? 单例模式就是经过多次实例化,指向的是同一实例 为何要用单例模式? 可以节省内存资源 如何用单例模式? 方式一:利用绑定方法 ...

  8. 牛掰本机限速软件appband

    带宽调度器AppBand可以为Windows应用程序分配网络带宽并指定数据收发的优先级,用软件的方式实现桌面应用的简单QOS调度.(1) P2P方式的下载软件(BT/eMule/迅雷等)或者在线播放占 ...

  9. 解决Android中,禁止ScrollView内的控件改变之后自动滚动 - 转

    问题: 最近在写一个程序界面,有一个scrollVIew,其中有一段内容是需要在线加载的. 当内容加载完成后,ScrollView中内容的长度会发生改变,这时ScrollView会自动下滚,如下图所示 ...

  10. c# 菜鸟包裹查询

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...