当前位置: 首页 > wzjs >正文

坂田网站建设学做视频的网站有哪些内容

坂田网站建设,学做视频的网站有哪些内容,房屋中介网站怎么做,厦门seo代理商1.集合set 概念 set就是数学上的集合——每个元素最多只出现一次,和sort一样,自定义类型也可以构造set,但同样必须定义“小于”运算符。 例题(安迪的第一个字典) 问题描述 输入一个文本,找出所有不同的…

1.集合set

概念

set就是数学上的集合——每个元素最多只出现一次,和sort一样,自定义类型也可以构造set,但同样必须定义“小于”运算符。

例题(安迪的第一个字典)

问题描述

输入一个文本,找出所有不同的单词(连续的字母序列),按字典序从小到大输出。单词不区分大小写。

样例输入

Adventures in Disneyland

Two blondes were going to Disneyland when they came  to a fork in the road.The sign read: "Disneyland Left."

So they went home.

样例输出(为了节约篇幅只保留前五行)

a

adventures

blondes

came 

disneyland

 示例代码

#include<iostream>
#include<sstream>
#include<set>
#include<string>
using namespace std;
set<string> dict;//string集合
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);//插入dict中并从小到大排序}}for (set<string>::iterator it = dict.begin(); it != dict.end(); ++it) {//遍历输出cout << *it << "\n";}return 0;
}

分析

iterator的意思是迭代器,是STL中的重要概念,类似于指针。和“vector类似于数组一样”,这里的“类似”指的是用法类似。 

2.映射map

概念

 map就是i从键(key)到值(value)的映射。因为重载了[]运算符,map像是数组的“高级版”。然后可以用一个map<string,int>month_name来表示“月份名字到月份编号”的映射,然后用month_name["July"]=7这样的方式来赋值。

例题(反片语)

问题描述

输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文本中的另外一个单词。在判断是否满足条件时,字母不分大小写,但在输出时应保留输入中的大小写,按字典序进行排列(所有大写字母在所有小写字母的前面)。

样例输入

ladder came tape soon leader acme RIDE lone Dreis peat

ScALE orb eye Rides dealer NotE derail LaCes drIed 

noel dire Disk mace Rob dries

#

样例输出

Disk

NotE

derail

drIed

eye

ladder

soon

示例代码

#include<iostream>
#include<cctype>
#include<vector>
#include<string>
#include<map>
#include<algorithm>
using namespace std;map < string, int > cnt;
vector<string> words;string repr(const string& s) {//将单词s进行“标准化”string ans = s;for (int i = 0; i < ans.length(); i++) {//将字母全部变为小写ans[i] = tolower(ans[i]);}sort(ans.begin(), ans.end());//将字母进行大小写排序return ans;
}
int main() {int n = 0;string s;while (cin >> s) {if (s[0] == '#') {break;}words.push_back(s);string r = repr(s);if (!cnt.count(r)) {//如果该种字母排序没出现过,该种排序出现的次数置为0cnt[r] = 0;}cnt[r]++;//无论是否出现过,次数都要加1}vector<string> ans;for (int i = 0; i < words.size(); i++) {if (cnt[repr(words[i])] == 1) {//如果该单词的排序只出现过一次ans.push_back(words[i]);}}sort(ans.begin(), ans.end());//从小到大排序for (int i = 0; i < ans.size(); i++) {cout << ans[i] << "\n";}return 0;
}


文章转载自:

http://CoOUeuJm.dpfLt.cn
http://Te1TjaOy.dpfLt.cn
http://exs3B5Ap.dpfLt.cn
http://aRPy1ntl.dpfLt.cn
http://TUGYahuX.dpfLt.cn
http://duJKtsm1.dpfLt.cn
http://i1aDNIf2.dpfLt.cn
http://9eBTZAul.dpfLt.cn
http://ksRNEXDU.dpfLt.cn
http://jhlqdSki.dpfLt.cn
http://pWFKlU1l.dpfLt.cn
http://RJthhgeR.dpfLt.cn
http://ePLA2wjP.dpfLt.cn
http://klqocP0J.dpfLt.cn
http://KCnHsM1e.dpfLt.cn
http://h3oZX1jO.dpfLt.cn
http://Z2lLzDeY.dpfLt.cn
http://uXVU6K8S.dpfLt.cn
http://cwHYG20d.dpfLt.cn
http://J7UXVqIO.dpfLt.cn
http://cKflLeE1.dpfLt.cn
http://jnhGcWiv.dpfLt.cn
http://6stnFO4o.dpfLt.cn
http://x00rRNeF.dpfLt.cn
http://tVsxE1vV.dpfLt.cn
http://JY9UkaTt.dpfLt.cn
http://vttYt6B6.dpfLt.cn
http://svImRWgS.dpfLt.cn
http://NmNxVmcN.dpfLt.cn
http://FeofdCUZ.dpfLt.cn
http://www.dtcms.com/wzjs/635724.html

相关文章:

  • 聊城做网站的公司教程河南建设监理协会网站电话
  • 网站无备案号怎么办找seo外包公司需要注意什么
  • 做网站卖水果哪里进货如何做监控网站
  • 没有公司怎么做网站群晖外网打开wordpress
  • 网站关于我们怎么做单页面如何搭建自己的小程序
  • 怎样用ps做网站首页图百度官网网站登录
  • 广东建设网站深圳外贸推广公司
  • 厦门旅游网站设计企业网站建设一般多少钱
  • 建设工程报建备案网站机智云物联网开发平台
  • 汽车网站网页模板单页销售网站源码
  • 宁夏信用建设官方网站想学网站建设方向的研究生
  • 迎访问中国建设银行网站-seo技术 快速网站排名
  • 公司核名在哪个官方网站wordpress编辑器分段
  • 贵阳免费网站建设国家企业信用公示网官网
  • 上海韵茵网站建设大连网站的建设
  • 开网络网站建设公司的优势网站标题优化排名
  • 白云做网站SEO邯郸网站改版费用
  • 网站建设的基本流程有哪些品牌网站建设黑白I狼J
  • 开封建站公司河南信合建设投资集团有限公司网站
  • 莱州市双语网站wordpress设置导航栏
  • 网站系统维护一般多长时间信息流广告文案
  • 视频网站主持人wordpress升级500
  • 有关网页设计与网站建设的文章创意产品设计说明范文
  • 昌平上门做网站那百度站长工具官网
  • 广东宇晟建设工程有限公司网站程序员做网站给女朋友
  • 网站设计标准字体wordpress卡密支付插件
  • 便民的网站app怎么做店铺设计网站推荐
  • 网站模板哪里下载南京网站开发
  • dedecms一键更新网站流量型网站 cms
  • 简历模板文档京东网站优化