码迷,mamicode.com
首页 > 其他好文 > 详细

1035 Password

时间:2018-12-11 00:31:55      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:stream   color   lse   mod   typedef   isp   else   iostream   turn   

水题~

用string特别方便

技术分享图片
#include <iostream>
#include <cstring>
#include <string>
#include <sstream>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#define maxn 1005
#define INF 0x3f3f3f3f
#define EPS 1e-6
#define pi acos(-1.0)
using namespace std;
typedef long long ll;
string name,pass;
string ansn[maxn],ansp[maxn];
int main()
{
    int n;
    cin>>n;
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        cin>>name>>pass;
        int len=pass.length();
        int mark=0;
        for(int j=0;j<len;j++)
        {
            if(pass[j]==1)
            {
                pass[j]=@;
                mark=1;
            }
            else if(pass[j]==0)
            {
                mark=1;
                pass[j]=%;
            }
            else if(pass[j]==l)
            {
                mark=1;
                pass[j]=L;
            }
            else if(pass[j]==O)
            {
                mark=1;
                pass[j]=o;
            }
        }
        if(mark)
        {
            ansn[cnt]=name;
            ansp[cnt]=pass;
            cnt++;
        }
    }
    if(cnt==0)
    {
        if(n==1)
            cout<<"There is 1 account and no account is modified"<<endl;
        else
            cout<<"There are "<<n<<" accounts and no account is modified"<<endl;
    }
    else
    {
        cout<<cnt<<endl;
        for(int i=0;i<cnt;i++)
        {
            cout<<ansn[i]<<" "<<ansp[i]<<endl;
        }
    }
    return 0;
}
View Code

 

1035 Password

标签:stream   color   lse   mod   typedef   isp   else   iostream   turn   

原文地址:https://www.cnblogs.com/FTA-Macro/p/10099960.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!