[热身题][hdoj_2072]单词数
来源:互联网 发布:手机解压缩密码软件 编辑:程序博客网 时间:2024/06/06 05:19
// hdoj_2072 单词数// 0MS236K695 BGCC#include <stdio.h>#include <string.h>char word[100000];char arr[100][100]; //arr用于存储以前出现过的单词int main(void){int len, pos, count;char temp[100];while(gets(word) && strcmp(word, "#") != 0){len = strlen(word);pos = 0;count = 0;// pos加单词长度一直到>=lenwhile(pos < len){sscanf(word + pos, "%s", temp); //把一个单词存入temp,空格忽略int i;for(i = 0; i < count; i ++)if(strcmp(arr[i], temp) == 0)//如果和以前存入的单词相同,则不计数break;if(i == count)strcpy(arr[count++], temp); //把temp存入arr,并计数器cnt加一/*用pos来记录下次读取的位置*/for(i = pos; word[i] == ' '; i++)//空格pos++;pos += strlen(temp) + 1;//单词}//判断是否全为空格int k, m = 0;for(k = 0; k < len; k ++) if(word[k] == ' ') m ++; if(m == len) printf("0\n"); else printf("%d\n", count);}return 0;}
- [热身题][hdoj_2072]单词数
- [热身题][hdoj_2097]Sky数
- SeedCoder2014热身题6:优雅数对
- 数单词
- 单词数
- 单词数
- 数单词
- 单词数
- 单词数
- 单词数
- 单词数
- 单词数
- 单词数
- 单词数
- 单词数
- 单词数
- 单词数
- 单词数
- Bitmap重要属性
- Fedora 14 安装QT和QT-Embedded
- ORACLE PL/SQL 触发器精品
- 浅谈bitmap算法
- 从0开始比从1开始有啥好处
- [热身题][hdoj_2072]单词数
- 版本号
- Graphviz属性网址
- Windows Store apps开发[10]通知使用(Toast,Tile和Badge)
- Serializable接口
- boost asio 应用方法学——在模版中隐藏实现
- 查看特定端口被占用的程序PID
- POJ 2516 Minimum Cost KM算法 或者 最小费用最大流
- 去掉Eclipses的鼠标悬浮提示和增加输代码提示