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         else
51         {
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 }
时间: 2024-10-07 05:06:38

1035 Password (20)的相关文章

PAT 1035. Password (20)

1035. Password (20) To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) fro

PAT甲级——1035 Password (20分)

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase)

PAT甲题题解-1035. Password (20)-水

题意:给n个用户名和密码,把密码中的1改为@,0改为%,l改为L,O改为o. 让你输出需要修改密码的用户名个数,以及对应的用户名和密码,按输入的顺序.如果没有用户需要修改,则输出对应的语句,注意单复数... 没啥好说的,就for一遍密码,把需要改的改下,存入到ans中去. #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cm

PAT Advanced 1035 Password (20分)

To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase)

PAT:1035. Password (20) AC

#include<stdio.h> #include<string.h> typedef struct STU { char mID[15]; char mpass[15]; bool tag; }STU; STU arr[1010]; int main() { memset(arr,0,sizeof(arr)); int n,change=0; scanf("%d",&n); for(int i=0 ; i<n ; ++i) { scanf(&q

pat1035. Password (20)

1035. Password (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is

1035. Password

1035. Password (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is

pat 1035 Password(20 分)

1035 Password(20 分) To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zero) fro

A1035 Password (20)(20 分)

A1035 Password (20)(20 分) To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L in lowercase), or 0 (zer