zju pat 1035

zju pat 1035
//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;
}
zju pat 1035

zju pat 1035

上一篇:py2exe使用方法


下一篇:hdu 4405 Aeroplane chess (期望dp)