UVa10615 Andy's First Dictionary(集合set)
这道题主要用到了set容器和stringstream,用起来非常方便,我第一次见识到,觉得十分的炫酷……
而且,竟然可以将自己写的单词按照字典序排列,真的太酷了。
下面是书上的代码,目前还处于初学状态,所以都是摘抄例题的代码,希望不久之后,我可以用学到的技能自己做出题来。
晚安啦。
#include<iostream>
#include<string>
#include<set>
#include<sstream>
using namespace std; set<string> dict;//string集合 int main(){
string s,buf;
while(cin>>s&&s!="quit"){
for(int i=;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);
}
for(set<string>::iterator it=dict.begin();it !=dict.end();++it)
cout<<*it<<"\n";
return ;
}
UVa10615 Andy's First Dictionary(集合set)的更多相关文章
- UVa 10815 Andy's First Dictionary
感觉这道题要比之前几个字符串处理的题目难度要大了一些. 题目大意:给若干行字符串,提取出所有单词并去掉重复的,最后按字典顺序输出. 对于输入大致有两种思路,一种是逐个读入字符,遇到字母的话就放到wor ...
- UVa10815.Andy's First Dictionary
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...
- Problem C: Andy's First Dictionary
Problem C: Andy’s First DictionaryTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 5[Submit] ...
- 【UVA - 10815】Andy's First Dictionary (set)
Andy's First Dictionary Description 不提英文了 直接上中文大意吧 XY学长刚刚立下了再不过CET就直播xx的flag,为了不真的开启直播模式,XY学长决定好好学习英 ...
- UVA-10815 Andy's First Dictionary (非原创)
10815 - Andy's First Dictionary Time limit: 3.000 seconds Problem B: Andy's First DictionaryTime lim ...
- STL语法——集合:set 安迪的第一个字典(Andy's First Dictionary,UVa 10815)
Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...
- 安迪的第一个字典(Andy's First Dictionary,UVa 10815)
Description Andy, , has a dream - he wants to produce his very own dictionary. This is not an easy t ...
- Andy's First Dictionary
Description Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy ...
- C#Dictionary集合的使用
题目:输入一串字符串字母,比如:Welcome to China,比较每个字母出现的次数,不区分大小写. 解决这道题的方法很多.可能一百个人有一百个思路.当时第一眼看到这个题我的思路是:先将接受的一串 ...
随机推荐
- CSP考试策略
准备 带好手表,身份证,准考证,文具,和矿泉水(热水). 考试之前 如果时间比较充足,可以重启测试保护是否解开. 调整显示屏亮度,检查键盘.鼠标. 关掉拓展名隐藏. 写个简单程序测试是否有异常,测试对 ...
- Stream系列(八)Reduce方法使用
裁减计算 视频讲解: https://www.bilibili.com/video/av77715582/ EmployeeTest.java package com.example.demo; i ...
- paper:Exploiting Query Reformulations for Web Search Result Diversification
一. 使用查询重构来用于网页搜索结果多样性 paper本文贡献: 1. 提出了一个概率框架,这个框架显式地建模了模糊查询的信息需求---利用子查询, 2. 分析了子查询的有效性---从由三个搜索引擎提 ...
- 【LOJ】#3123. 「CTS2019 | CTSC2019」重复
LOJ3123 60pts 正难则反,熟练转成总方案数减掉每个片段都大于等于s的字典序的方案 按照一般的套路建出kmp上每个点加一个字符的转移边的图(注意这个图开始字母必须是nxt链中下一个相邻的字符 ...
- dij 费用流
#include <bits/stdc++.h> using namespace std; typedef long long lld; const int MAXN = 50010, M ...
- 老贾的幸福生活day03 之思维导图
思维导图 层级关系 从大范围到具体 编程语言 编译型 C C++ ...... 解释型 python php ......... python 基础语法 基础数据类 ...
- django初步了解3
目录 JsonResponse模块 form表单上传文件 FBV与CBV django settings源码分析及实际应用 模板语法 模板传值 模板过滤器 标签 if标签 for标签 with标签 自 ...
- es reindex
# 添加mapping: url -X POST 'http://127.0.0.1:9200/indexName/typeName/_mapping?pretty' -d '{ "type ...
- 深入理解计算机系统 第十一章 网络编程 part1 第二遍
客户端-服务器编程模型 每个网络应用都是基于客户端-服务器模型的.采用这个模型,一个应用是由一个服务器进程和一个或者多个客户端进程组成.服务器管理某种资源,并且通过操作这种资源来为它的客户端提供某种服 ...
- hdu 1969 pie 卡精度的二分
Pie Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submiss ...