首页 > 其他 > 详细

1035 Password

时间:2018-12-11 00:19:07      阅读:145      评论:0      收藏:0      [点我收藏+]

水题~

用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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!