`
风吹过PP好冷
  • 浏览: 36432 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

PAT1035 Password

    博客分类:
  • PAT
 
阅读更多

Sample Input 1:

3
Team000002 Rlsp0dfa
Team000003 perfectpwd
Team000001 R1spOdfa
Sample Output 1:
2
Team000002 RLsp%dfa
Team000001 R@spodfa
Sample Input 2:
1
team110 abcdefg332
Sample Output 2:
There is 1 account and no account is modified
Sample Input 3:
2
team110 abcdefg222
team220 abcdefg333
Sample Output 3:
There are 2 accounts and no account is modified

 

 

 

#include <iostream>
#include <string>
#include <iomanip>
#include <vector>
using namespace std;

struct USERINFO
{
    string username;
    string password;
    int flag;
    USERINFO()
    {
        flag = 0;
    }
};

int IsModify(string &password)
{
    int flag = 0;
    for (int i = 0; i < password.length(); i++)
    {
        switch (password[i])
        {
        case '1':
            password[i] = '@';
            flag = 1;
            break;
        case '0':
            password[i] = '%';
            flag = 1;
            break;
        case 'l':
            password[i] = 'L';
            flag = 1;
            break;
        case 'O':
            password[i] = 'o';
            flag = 1;
            break;
        default:
            break;
        }
    }

    return flag;
}

int main()
{
    int N;
    cin>>N;
    int count = 0;
    vector<USERINFO> V;
    for (int i = 0; i < N; i++)
    {
        USERINFO info;
        cin>>info.username>>info.password;
        info.flag = IsModify(info.password);
        if (info.flag == 1)
        {
            count++;
        }   
        V.push_back(info);
    }

    if (count == 0)
    {
        if (N > 1)
        {
            cout<<"There are "<<N<<" accounts and no account is modified";
        }
        else
        {
            cout<<"There is 1 account and no account is modified";
        }
        return 0;
    }

    cout<<count<<endl;
    for (int i = 0; i < N; i++)
    {
        if (V[i].flag == 1)
        {
            cout<<V[i].username<<" "<<V[i].password<<endl;
        }
    }

    return 0;
}
分享到:
评论

相关推荐

    pat题目分类.docx

    1035 Password (20 分)【对应的替换,注意输出,巧用vector和string】 1005 Spell It Right (20 分)【int与string互换,hash打表】 1082 Read Number in Chinese (25 分)【将数字转成中文】 1093 Count ...

    CISCO 技术大集合

    instead of the enable password when it exists. Enter enable secret: cisco 3.设置进入特权状态的密码(password),此密码只在没有密文时起作用,并且在设置以后会以明文方式显示: The enable password is ...

    efoodgr::hamburger:一个非官方的工具来管理您的efood.gr帐户和下订单

    :hamburger: efoodgr 一个非官方的工具,用于管理您的帐户和下订单。给我买咖啡 :hot_beverage:... login ( 'your.email@efood.gr' , 'your-password-or-pat' ) ; let addresses = await session . getUserAddresses

    迪拜:生成和预览存折通行证

    是iOS 6的一项功能,可管理登机牌,电影票,零售优惠券和会员卡。 使用 ,开发人员可以注册Web服务,以自动更新通行证上的内容,例如登机牌上的登机口更改或在会员卡中添加积分。... password = "/pat

    Java版QQ签到源码-dgc-gateway:dgc网关的存储库

    Java版QQ签到源码欧盟数字 COVID 证书网关 • • • • • • 关于 该存储库包含欧盟数字 ...用于在所有国家后端服务器...替换${app.packages.password} GitHub Docker 注册表 在运行进一步的docker login docker.pkg.gith

    connect-search:Trifenix存储库连接天蓝色搜索

    dotnet nuget add source "json azure devops package url" -n name_repo_artifact -u anything -p &lt;pat&gt; --store-password-in-clear-text 范围:打包(读取),打包(读取和写入)或打包(读取,写入和管理)。

    graph:操作微软微软图形段落trifenix连接

    dotnet nuget add source "json azure devops package url" -n name_repo_artifact -u anything -p &lt;pat&gt; --store-password-in-clear-text 范围:打包(读取),打包(读取和写入)或打包(读取,写入和管理)。

    connect-storage-azure:蔚蓝海岸

    dotnet nuget add source "json azure devops package url" -n name_repo_artifact -u anything -p &lt;pat&gt; --store-password-in-clear-text 范围:打包(读取),打包(读取和写入)或打包(读取,写入和管理)。

    trifenix-connect-bus:达托斯天蓝色巴士运营公司

    dotnet nuget add source "json azure devops package url" -n name_repo_artifact -u anything -p &lt;pat&gt; --store-password-in-clear-text 范围:打包(读取),打包(读取和写入)或打包(读取,写入和管理)。

    external-search-cosmos

    dotnet nuget add source "json azure devops package url" -n name_repo_artifact -u anything -p &lt;pat&gt; --store-password-in-clear-text 范围:打包(读取),打包(读取和写入)或打包(读取,写入和管理)。

    trifenix-cosmos-db:模特儿歌剧院Trifenix连接en cosmosdb

    dotnet nuget add source "json azure devops package url" -n name_repo_artifact -u anything -p &lt;pat&gt; --store-password-in-clear-text 范围:打包(读取),打包(读取和写入)或打包(读取,写入和管理)。

    python实现的config文件读写功能示例

    本文实例讲述了python实现的config文件读写功能。分享给大家供大家参考,具体如下: 1、设置配置文件 [mysql] host = 1234 port = 3306 user = root ... root_path = os.path.dirname(os.path.dirname(os.pat

Global site tag (gtag.js) - Google Analytics