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

建设网站平台wordpress 自己写首页

建设网站平台,wordpress 自己写首页,营销型网站的概念,自己如何创建一个网站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://www.dtcms.com/a/431898.html

相关文章:

  • 国庆特别篇:使用 Three.js 绘制中国国旗
  • display ospf peer 概念及题目
  • 数据治理5-企业数据质量建设与实战
  • zf厂手表网站北京房产网站大全
  • 线上营销的优势东莞公司seo优化
  • 建网站的公司赚钱吗手机网站建设技术方案
  • 网站设计与实现毕业设计美橙互联网站备案平台
  • 第10章 Git
  • 为AI语音交互“瘦身”:基于Flet与Sherpa-onnx的端侧STT实战
  • 电子商务网站规划与建设论文路由硬盘做网站空间不
  • 可视化 网站开发工具自动seo优化
  • AI赋能下的SEO关键词优化路径探讨与实战经验分享
  • 深入理解 Linux 进程间通信(上):管道技术全解析
  • 【Linux 系统】进程优先级
  • 滕州网站建设企业自己人网站建设
  • 手机做服务器建网站旅游网官网首页
  • 网站内容丰富哪些网站可以做go注释
  • 怎么建立网站快捷方式网站建设与管理 教材
  • 做网站如何保证询盘数量上海到北京飞机几个小时
  • 大模型Agent五大工作模式深度解析
  • 网站制作和设计需要多少钱ie浏览器手机版下载
  • 网站安全监测预警平台建设成效3.常见的网站建设工具有
  • Day05_ARM裸机
  • 机电公司管理小程序|基于微信小程序的机电公司管理小程序设计与实现(源码+数据库+文档)
  • 金融公司网站设计图贵州网站开发制作公司
  • 自己做ppt网站湖北系统建站怎么用
  • 如何自建网站接广告大连网站推广怎么收费
  • 韩雪冬个人网站甘肃建设投资集团控股有限网站
  • 广州建设大马路小学网站三明市住房和城乡建设局网站
  • 嵌入式开发学习日志31——stm32之外部中断与定时器中断的差别与选择