PAT 甲级 A1035 (2019/02/10)

 1 #include<cstdio>
 2 #include<cstring>
 3 struct user{
 4     char id[20];
 5     char password[20];
 6     bool ischange;
 7 }List[1001];
 8 bool isalter(user &t, int &count){//1 (one) by @, 0 (zero) by %, l by L, and O by o
 9     int len = strlen(t.password);
10     for(int i = 0; i < len; i++){
11         if(t.password[i] == ‘1‘){
12             t.password[i] = ‘@‘;
13             t.ischange = true;
14         }else if(t.password[i] == ‘0‘){
15             t.password[i] = ‘%‘;
16             t.ischange = true;
17         }else if(t.password[i] == ‘l‘){
18             t.password[i] = ‘L‘;
19             t.ischange = true;
20         }else if(t.password[i] == ‘O‘){
21             t.password[i] = ‘o‘;
22             t.ischange = true;
23         }
24     }
25     if(t.ischange == true)
26         count++;
27 }
28 int main(){
29     int N, count = 0;
30     scanf("%d", &N);
31     for(int i = 0; i < N; i++){
32         scanf("%s%s", List[i].id, List[i].password);
33         List[i].ischange = false;
34     }
35     for(int j = 0; j < N; j++)
36         isalter(List[j], count);
37     if(count == 0){
38         if(N == 1) printf("There is %d account and no account is modified",N);
39         else printf("There are %d accounts and no account is modified",N-count);
40     }else{
41         printf("%d\n", count);
42         for(int i = 0; i < N; i++)
43         if(List[i].ischange == true)
44             printf("%s %s\n",List[i].id,List[i].password);
45     }
46     return 0;
47 } 

原文地址:https://www.cnblogs.com/zjsaipplp/p/10415834.html

时间: 2024-08-30 17:30:02

PAT 甲级 A1035 (2019/02/10)的相关文章

PAT 甲级 A1073 (2019/02/10) NULL(18/20)

1 #include<cstdio> 2 #include<cstring> 3 int main(){ 4 char Array[10010]; 5 scanf("%s",Array); 6 int i = 0, pos, cnt, length = strlen(Array); 7 while(Array[i++] != 'E'); 8 pos = i - 1; 9 cnt = i + 1; 10 if(Array[0] == '-') 11 printf(

PAT 甲级 A1005 (2019/02/10)

1 #include<cstdio> 2 #include<cstring> 3 char str[10][6] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; 4

PAT 甲级 A1001 (2019/02/10)

1 #include<cstdio> 2 #include<cstdlib> 3 int main(){ 4 long A,B,C,SUM; 5 scanf("%ld%ld",&A,&B); 6 SUM = A + B; 7 C = abs(SUM); 8 if(C < 1000) 9 printf("%ld",SUM); 10 if(C >= 1000 && C < 1000000) 11

PAT甲级【2019年3月考题】——A1158 TelefraudDetection【25】

Telefraud(电信诈骗) remains a common and persistent problem in our society. In some cases, unsuspecting victims lose their entire life savings. To stop this crime, you are supposed to write a program to detect those suspects from a huge amount of phone c

CF-1093 (2019/02/10)

CF-1093 1093A - Dice Rolling 输出x/2即可 #include<bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int x; cin >> x; cout << x / 2 << endl; } return 0; } 1093B - Letters Rearranging 当且仅当字符串中所有字符都相同时,

PAT甲级1005 Spell It Right

题目:PAT甲级 1005 题解:水题.看到题目的第一时间就在想一位一位的mod,最后一加一转换就完事了.结果看到了N最大为10的100的次方,吓得我赶紧放弃这个想法... 发现碰到这种情况用字符串十分好用,这道题应该考察的就是这一点.大致思路就是把数字的每一位放到字符串中,然后通过ASCII码得到每一位的相加结果num,然后把num一位一位的放到stack中,使用stack是因为它先进先出的特性,最后输出就行了. 代码: 1 #include<cstdio> 2 #include<qu

【谜客帝国】第147届月思主擂谜会(2019.02.15)

 [谜客帝国]第147届月思主擂谜会(2019.02.15) 主持计分:东东 1.“人在中天日月间”(9笔字)春/月思 [注:面出陈孚<开平即事二首>,“势超大地山河上,-.”] 2. 玉漏声中烟气袅(3字法国奢侈品牌)YSL/月思 3. 双双相念初相爱(2字著名动漫人物)菜菜/月思 4.“数点燕云州外.雪霜威”(足球用语二,4+3)4132.451/月思 [注:面出余文<相见欢>,“登高望断龙旗,未曾归.几度中原北定,梦依稀.朔风乱,胡尘漫,掩斜晖.-.”] 5.“十载同心如一人

PAT甲级考试题库1001 A+B Format 代码实现及相关知识学习

准备参加九年九月份的PAT甲级证书考试,对网站上的题目进行总结分析: 1001题 A+B Format (20 分) Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). 计算a+b的值并以一定格式输出其和sum(数字需要

PAT甲级专题|最短路

PAT甲级最短路 主要算法:dijkstra 求最短最长路.dfs图论搜索. 1018,dijkstra记录路径 + dfs搜索路径最值 25分,错误点暂时找不出.. 如果只用dijkstra没法做,只能得20分 #include<bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 510; int cmax,n,ter,m; int caps[maxn]; int g[maxn][m