hdu 1039 (string process, fgets, scanf, neat utilization of switch clause)
来源:互联网 发布:iphone7换铃声软件 编辑:程序博客网 时间:2024/06/07 19:09
(string process, fgets, scanf, neat utilization of switch clause)
simple problem, simple code.
#include <cstdio>#include <algorithm>#define MAXLEN 22char password[MAXLEN];int main() { //freopen("input.txt","r",stdin); int nc,nv,vcnt, invalid; char *p; while(scanf("%20s",password)==1 && strcmp(password,"end")!=0) { nc=nv=vcnt=0; invalid=0; p=password-1; while(*++p) { switch(*p) { case 'e': case 'o': case 'a': case 'i': case 'u': ++vcnt; ++nv; nc=0; break; default: ++nc; nv=0; break; } if(*p==*(p+1) && *p!='e' && *p!='o') { invalid=1; break; } if(nc>2 || nv>2) { invalid=1; break; } } if(invalid || vcnt==0) printf("<%s> is not acceptable.\n",password); else printf("<%s> is acceptable.\n",password); } return 0;}
0 0
- hdu 1039 (string process, fgets, scanf, neat utilization of switch clause)
- hdu 1035 (usage of sentinel, proper utilization of switch and goto to make code neat)
- hdu 1033 (bit masking, utilization of switch, '\0' as end of c string)
- scanf/gets/puts/fgets
- scanf, gets, fgets
- 区别 scanf gets fgets
- scanf()、gets()、fgets总结
- scanf gets fgets
- fgets and scanf
- 关于gets,fgets,scanf
- fgets和scanf的区别
- c 中的scanf, gets,fgets
- 关于scanf和fgets连用
- Linux gets scanf fgets 分析
- fgets与scanf的区别
- hdu 1047 (big integer sum, fgets or scanf, make you func return useful infos)
- The potential utilization value of vertical mill
- CPU Utilization, CPU Load Average, Context Switch Rate
- Fragment和Activity之间的数据传递
- Java类加载器总结
- 开始学习C++心得实例(4)
- LeetCode——Valid Palindrome
- poj_1789
- hdu 1039 (string process, fgets, scanf, neat utilization of switch clause)
- 比较全面的MySQL优化参考
- 进程上下文与中断上下文
- 串口UART
- j2se学习笔记-java.lang.String
- qualcomm platform camera porting
- stix/taxii 威胁情报共享机制的解读(1)
- java之二叉搜索树的后序遍历序列
- Linux开机启动过程