1035. Password
来源:互联网 发布:c语言字符串数组拷贝 编辑:程序博客网 时间:2024/06/07 05:31
http://pat.zju.edu.cn/contests/pat-a-practise/1035
创建结构体存信息方便。
// #include <stdio.h>#include <string.h>#define SIZE 15#define MAXSIZE 1000+5void replace(char a[], char b[]){int i=0;while(a[i] != 0){switch(a[i]){case '1': b[i]='@'; break;case '0': b[i]='%'; break;case 'l': b[i]='L'; break;case 'O': b[i]='o'; break;default:b[i] = a[i];break;}i++;}}int main(){#ifdef ONLINE_JUDGE#elsefreopen("E:\\in.txt", "r", stdin);freopen("E:\\out.txt", "w", stdout);#endifint n;scanf("%d", &n);if(n == 1){puts("There is 1 account and no account is modified");return 0;}int m=0;char name[SIZE], pre[SIZE], after[SIZE];char buf[MAXSIZE][SIZE*2];memset(buf, 0, sizeof(buf));int num = n;while(num-->0){memset(name, 0, sizeof(name));memset(pre, 0, sizeof(pre));memset(after, 0, sizeof(after));scanf("%s %s", name, pre);replace(pre, after);if(strcmp(pre, after) != 0){strcpy(buf[m], name);strcat(buf[m], " ");strcat(buf[m], after);//strcat(buf[m], "\0");m++;}}if(m > 0){printf("%d\n", m);int i;for(i=0; i<m; i++){printf("%s\n", buf[i]);}}else{printf("There are %d accounts and no account is modified\n", n);}return 0;}
0 0
- 1035. Password
- 1035. Password
- 1035. Password
- 1035. Password
- 1035.Password
- 1035. Password
- 1035. Password
- 1035. Password
- 1035. Password (20)
- 【PAT】1035. Password (20)
- 1035. Password (20)-PAT
- 1035. Password (20)
- 1035. Password (20)
- 1035. Password (20)
- PAT 1035. Password (20)
- PAT 1035. Password
- 1035. Password (20)
- 1035. Password (20)
- iOS NSTimer使用教程
- cocos2d-x 源码剖析(13)
- MFC中获取各种类(文档、视图、框架、应用程序)指针的方法
- Android中实现view的更新有两组方法
- SharePoint Debug - Failed to load resource: the server responded with a status of 500
- 1035. Password
- cocos2d-x 源码剖析(14)
- GPS NMEA-0183协议详解
- strcpy,strncpy的区别
- oracle 存储过程无法编译解决方法
- 传入Throwable返回分好行的String
- 【C++】PAT(advanced level)1037. Magic Coupon (25)
- 也许我太过自我
- 细数JDK里的设计模式