1035. Password (20)

来源:互联网 发布:运动控制仿真软件 编辑:程序博客网 时间:2024/06/01 09:13
#include<cstdio>#include<cstring>struct Info{    char name[11];    char psw[11];    bool isChanged;}node[1001];int main(){    int n,m=0,tem;    scanf("%d",&n);    tem = n;    while (n--)    {        scanf("%s%s", node[n].name, node[n].psw);        for (int i = 0; i < strlen(node[n].psw); i++)        {            if (node[n].psw[i] == '1' || node[n].psw[i] == '0' || node[n].psw[i] == 'l' || node[n].psw[i] == 'O')            {                if (node[n].psw[i] == '1')                    node[n].psw[i] = '@';                else                if (node[n].psw[i] == '0')                    node[n].psw[i] = '%';                else                if (node[n].psw[i] == 'l')                    node[n].psw[i] = 'L';                else                if (node[n].psw[i] == 'O')                    node[n].psw[i] = 'o';                node[n].isChanged = true;            }        }    }    for (int i = 0; i < tem;i++)    if (node[i].isChanged)        m++;    if (m == 0)    {        if (tem>1)            printf("There are %d accounts and no account is modified", tem);        else            printf("There is 1 account and no account is modified");    }    else        printf("%d\n", m);    for (int i = tem; i >= 0; i--)    {        if (node[i].isChanged)        {            printf("%s %s", node[i].name, node[i].psw);                printf("\n");        }    }    return 0;}

注意单复数情况的输出格式。

0 0