cheng_you_know

学而时习之!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
//1035
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
typedef struct DATA
{
    char name[50];
    char password[50];
    bool modify_flag;
};
DATA data[1501];

char change(char c)
{
    switch(c)
    {
    case '1' : return '@';
    case 'l': return 'L';
    case '0' : return '%';
    case 'O': return 'o';
    default : return -1;
    }
}
int main()
{
    int N,i,j,no_count;
    bool easy_flag;
    while(scanf("%d",&N)!=EOF)
    {
        no_count = 0;
        for(i =0;i<N;i++)
        {
            scanf("%s %s",data[i].name,data[i].password);
            char *temp_s = data[i].password;
            easy_flag = false;
            for(j = 0;temp_s[j]!=0;j++)
            {
                char temp = change(temp_s[j]);
                if(temp != -1)
                {
                    temp_s[j] = temp;
                    easy_flag = true;
                }
            }
            if(!easy_flag)
            {
                no_count++;
                data[i].modify_flag = false;
            }
            else
                data[i].modify_flag = true;
        }
        if(no_count != N)
            printf("%d\n",N-no_count);
        for(i =0;i<N;i++)
        {
            if(data[i].modify_flag)
            {
                printf("%s %s\n",data[i].name,data[i].password);
            }
        }
        if(no_count == N)
        {
             if(N <= 1)  
                printf("There is %d account and no account is modified\n", N);  
            else  
                printf("There are %d accounts and no account is modified\n", N); 
        }
    }
    return 0;
}
posted on 2014-01-29 12:06  cheng_you_know  阅读(145)  评论(0编辑  收藏  举报