浙大PAT 1035题 1035. Password

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
    int i,j,n;
    char name[1002][12],pwd[1002][12];
    char ansname[1002][12],anspwd[1002][12];
    int cnt=0,mark;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",name[i],pwd[i]);
        mark=0;
        for(j=0;pwd[i][j]!='\0';j++){
            if(pwd[i][j]=='1') {pwd[i][j]='@';mark=1;}
            else if(pwd[i][j]=='0') {pwd[i][j]='%';mark=1;}
            else if(pwd[i][j]=='l') {pwd[i][j]='L';mark=1;}
            else if(pwd[i][j]=='O') {pwd[i][j]='o';mark=1;}
        }
        if(mark){
            strcpy(ansname[cnt],name[i]);
            strcpy(anspwd[cnt],pwd[i]);
            cnt++;
        }
    }
    if(cnt==0){
        if(n==1) printf("There is 1 account and no account is modified\n");
        else printf("There are %d accounts and no account is modified\n",n);
    }else{
        printf("%d\n",cnt);
        for(i=0;i<cnt;i++){
            printf("%s %s\n",ansname[i],anspwd[i]);
        }      
    }
    system("pause");
    return 0;
}

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值