首页 > 代码库 > 1035 Password (20)

1035 Password (20)

 1 #include <stdio.h> 2 #include <string.h> 3 struct MyStruct 4 { 5     char ID[11]; 6     char Password[11]; 7     bool changed; 8 }; 9 int main()10 {11     int n,i,j;12     MyStruct User[1001];13     while(scanf("%d",&n)!=EOF)14     {15         for(i=0;i<n;i++)16             User[i].changed=false;17         int count = 0;18         for(i=0;i<n;i++)19         {20             getchar();21             scanf("%s %s",User[i].ID,User[i].Password);22             int fir=1;23             for(j=0;j<strlen(User[i].Password);j++)24             {25             26                 if(User[i].Password[j]==1||User[i].Password[j]==0||User[i].Password[j]==l||User[i].Password[j]==O)27                 {28                     if(fir) 29                     {30                         fir=0;31                         ++count;32                     }33                     if(User[i].Password[j]==1) User[i].Password[j]=@;34                     else if(User[i].Password[j]==0) User[i].Password[j]=%;35                     else if(User[i].Password[j]==l) User[i].Password[j]=L;36                     else if(User[i].Password[j]==O) User[i].Password[j]=o;37                     User[i].changed=true;38                 }39     40             }41         }42 43         if(count>0) 44         {45             printf("%d\n",count);46              for(i=0;i<n;i++)47                  if(User[i].changed)48                      printf("%s %s\n",User[i].ID,User[i].Password); 49         }50         else51         {52             if(n==1) printf("There is 1 account and no account is modified\n");53             else printf("There are %d accounts and no account is modified\n",n);54         }55     }56     return 0;57 }

 

1035 Password (20)