UVA 494 Kindergarten Counting Game
2014-07-25 21:12
344 查看
题意为统计单词的个数
这个菜鸟竟连这都不会了,搜的大神的代码,才A
看好代码,有技巧
还有一个不开数组的
这个菜鸟竟连这都不会了,搜的大神的代码,才A
看好代码,有技巧
#include<cstdio> #include<iostream> #include<ctype.h> #include<string.h> using namespace std; int main() { char ch[550]; int ok, cnt; while(gets(ch)) { cnt = 0; ok = 1; for(int i = 0; ch[i]; i ++) if(isalpha(ch[i])) //判断是否为大小写字母 { if(ok) { ok = 0; cnt ++; } } else ok = 1; printf("%d\n", cnt); } return 0; }
还有一个不开数组的
#include <stdio.h> #include<ctype.h> int main() { char c; int flag = 1, count = 0; while ((c = getchar()) != EOF) { if (isalpha(c)) { if (flag) { count++; flag = 0; } } else if (c == '\n') { printf("%d\n", count); count = 0; flag = 1; } else flag = 1; } return 0; }
相关文章推荐
- UVA 494 Kindergarten Counting Game
- UVA 494 Kindergarten Counting Game
- UVA - 494 Kindergarten Counting Game
- UVA 494 - Kindergarten Counting Game
- uva 494 Kindergarten Counting Game
- UVA 494 Kindergarten Counting Game
- UVA - 494 - Kindergarten Counting Game
- UVA 494 Kindergarten Counting Game 单词统计
- UVa494 - Kindergarten Counting Game,java写的
- UVA 494 - Kindergarten Counting Game
- 【UVA - 494 Kindergarten Counting Game】
- UVA 494 - Kindergarten Counting Game
- UVa 494 - Kindergarten Counting Game
- uva 494 - Kindergarten Counting Game
- UVA494 - Kindergarten Counting Game
- [UVa]494-Kindergarten Counting Game
- uva494 Kindergarten Counting Game
- UVa494 - Kindergarten Counting Game-难度1
- UVA - 494 Kindergarten Counting Game
- uva494 Kindergarten Counting Game