hdu 2072 (set)
来源:互联网 发布:ghostscript知乎 编辑:程序博客网 时间:2024/06/05 19:05
set容器中元素不重复,于是set中元素个数就是单词数
# include <cstdio># include <cstring># include <algorithm># include <iostream># include <set># include <sstream>//必要的头文件using namespace std;int main(){char line[100010];string word;set<string>map;while(cin.getline(line,sizeof(line),'\n')&&line[0]!='#')//从屏幕读取一行字符并赋予line{//istringstream对象可以绑定一行字符串,然后以空格为分隔符把该行分隔开来。istringstream stream(line);map.clear(); while(stream>>word)map.insert(word);cout<<map.size()<<endl;}return 0;}
# include <cstdio># include <cstring># include <algorithm># include <iostream># include <set># include <sstream>//必要的头文件using namespace std;int main(){string word,line;set<string>map;while(getline(cin,line)&&line!="#")//从屏幕读取一行字符并赋予line{//istringstream对象可以绑定一行字符串,然后以空格为分隔符把该行分隔开来。istringstream stream(line);map.clear(); while(stream>>word)map.insert(word);cout<<map.size()<<endl;}return 0;}
1 0
- hdu 2072 (set)
- HDU 2072 (STL set)
- set容器及hdu 2072
- hdu 2072 单词数,set,strtok
- HDU 2072 单词数 (set)
- HDU 2072 单词数 set使用
- HDU 2072 单词数 (STL:set)
- hdu 2072 单词数(set ,stringstream)
- HDU 1558 Segment Set
- hdu 1558 Segment set
- hdu 1558 Segment set
- HDU 4631 set维护
- hdu 1558 Segment set
- hdu 4585 Shaolin set
- HDU 1307 map&&set
- HDU Segment set
- hdu 5058 set应用
- HDU 1558 Segment set
- SysLog简介和java操作实例
- POJ1146第一次用next_permutation()
- GCC源码分析(一)——介绍与安装
- hdu 4905 The Little Devil II 区间DP 四边形不等式优化
- javase的复习-------8
- hdu 2072 (set)
- 两DD-WRT组建WDS设置
- java 反射获取方法(3)
- poj 1050 To the Max
- 线段树lazy标记??Hdu4902
- 回忆曾经写过的第一个Bash脚本
- Solr4.7源码分析-启动篇之Solr Cloud(二)——solr选举机制
- 随机产生20个正整数存入数组a中,且每个数均在1000-9999之间(包含1000和9999)。对数组进行排序,要求按每个数的后三位的大小进行升序排列,然后取出满足此条件的前10个数放入数组b中,如
- GCC源码分析(二)——前端