UVaOJ 494 - Kindergarten Counting Game
来源:互联网 发布:c语言break用法if 编辑:程序博客网 时间:2024/06/06 09:13
//本人复杂了的方法#include <stdio.h>#include <ctype.h>#include <string.h>char* trimSpace(char *str){if (str == NULL || *str == '\0'){return NULL;}while (!isalpha(*str) && *str != '\0'){++str;}return str;}char* trimWord(char *str){if (str == NULL || *str == '\0'){return NULL;}while (isalpha(*str) && *str != '\0'){++str;}return str;}int main(int argc, char *argv[]){char buf[200];memset(buf, '\0', sizeof(buf));while (fgets(buf, sizeof(buf), stdin) != NULL){int n = 0;char *tmp = trimSpace(buf);while ((tmp = trimWord(tmp)) != NULL){++n;tmp = trimSpace(tmp);}printf("%d\n", n);memset(buf, '\0', sizeof(buf));}return 0;}//简单明了的方法#include <stdio.h>int main(){char ch;int flag = true;int count = 0;while ((ch = getchar()) != EOF){if ((ch >= 'A' && ch <= 'z') || (ch >= 'a' && ch <= 'z')){if (flag){++count;flag = false;}}else if (ch == '\n'){printf("%d\n", count);count = 0;flag = true;}else{flag = true;}}return 0;}
0 0
- UVaOJ 494 - Kindergarten Counting Game
- UVaOJ 494 - Kindergarten Counting Game
- [UvaOJ]494-Kindergarten Counting Game
- UVaOJ 494 Kindergarten Counting Game
- uvaOJ 494 Kindergarten Counting Game //水题
- [UvaOJ - Getting Started] 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- Kindergarten Counting Game 494
- 494 - Kindergarten Counting Game
- 494 - Kindergarten Counting Game
- [Unity3D]Unity3D游戏开发之《愤怒的小鸟》弹弓实现
- 【雷电】源码分析(一)-- 进入游戏开始界面
- UVaOJ 10300 - Ecological Premium
- [C/C++标准库]_[初级]_[优先队列priority_queue的使用]
- UVaOJ 458 - The Decoder
- UVaOJ 494 - Kindergarten Counting Game
- lambda calculus语言解释器
- IceHe的技术博客自述
- boost::tie()和boost::variant()讲解
- 仿腾讯手机卫士的配置动画欢迎界面
- struts2表单ui
- 寄存器及七种寻址方式
- linux进程、调度、线程、进程上下文等几点理解
- HashMap与HashCode()、equals()的关系---在HashMap中实现以对象为键(key)