UVA 10815 安迪的第一个字典
来源:互联网 发布:开源直播系统源码 php 编辑:程序博客网 时间:2024/05/20 05:28
分析:这个题其实是非常水的,但是作为渣滓的我还是从中收获了很多新知识,比如学会了一点<set>的使用,而且知
道了在<set>中原来会自动按从小到大的顺序排序。知道了这些,这个题就简单了,只需读入,之后再用迭代器访问挨
着输就行了
另外,这个题需转换成小写字母,之后再用
stringstream ss(s);
while (ss>>buf) dict.insert(buf);插入就行了
关于stringstream ss(s),我也无法解释非常清楚,可以请教一下大神们
另外,这个题需转换成小写字母,之后再用
stringstream ss(s);
while (ss>>buf) dict.insert(buf);插入就行了
关于stringstream ss(s),我也无法解释非常清楚,可以请教一下大神们
代码如下:
#include <cstdio>#include <cstring>#include <set>#include <iostream>#include <sstream>using namespace std;set<string> dict;int main(){ string s,buf; while (cin>>s) { for (int i=0;i<s.length();i++) if (isalpha(s[i])) s[i]=tolower(s[i]); else s[i]=' '; stringstream ss(s); while (ss>>buf) dict.insert(buf); } set <string> ::iterator it; for (it=dict.begin();it!=dict.end();it++) cout<<*it<<endl; return 0;}
0 0
- UVA(WA) 10815 安迪的第一个字典
- UVa 10815 安迪的第一个字典
- UVa 10815 安迪的第一个字典
- UVA 10815安迪的第一个字典
- UVA 10815 安迪的第一个字典
- 例题:安迪的第一个字典(UVa 10815)
- uva 10815安迪的第一个字典
- 安迪的第一个字典(Andy's First Dictionary, UVa 10815)
- Uva 10815(string,set,vector,unique)安迪的第一个字典
- 例题 5-3 安迪的第一个字典(Andy's First Dictionary) UVa 10815
- 安迪的第一本字典(set)-uva 10815
- UVA10815-安迪的第一个字典
- 安迪的第一个字典
- uva10815安迪的第一个字典
- 安迪的第一个字典
- 安迪的第一个字典
- 安迪的第一个字典uva10815
- UVa10815 安迪的第一个字典
- 天方夜谭-第一夜
- 数据结构和算法经典100题-第23题
- Android中的加载动画效果
- hadoop入门--简单的MapReduce案例
- Android 的样式和主题
- UVA 10815 安迪的第一个字典
- python_多态
- RMAN实战7:list、report命令、相关动态视图、shell对RMAN监控
- 使用git提交代码到远程服务器
- Activity学习笔记
- 设计模式2—观察者模式
- 【C语言提高31】数组基础概念
- 线段树系列-hdu-1754-I Hate It-单点修改求区间最值
- IOS集成支付宝注意事项