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

设计师网站有哪些销售定制家具谷歌关键词搜索排名

设计师网站有哪些销售定制家具,谷歌关键词搜索排名,空间设计英文,seo竞价网站建设KY264 单词识别 题目描述: 输入一个英文句子,把句子中的单词(不区分大小写)按出现次数按从多到少把单词和次数在屏幕上输出来,次数一样的按照单词小写的字典序排序输出,要求能识别英文单词和句号。 输入描述: 输入…

KY264 单词识别

题目描述:

输入一个英文句子,把句子中的单词(不区分大小写)按出现次数按从多到少把单词和次数在屏幕上输出来,次数一样的按照单词小写的字典序排序输出,要求能识别英文单词和句号。

输入描述:

输入为一行,由若干个单词和句号组成

输出描述:

输出格式参见样例。

示例1

输入:

A blockhouse is a small castle that has four openings through which to shoot.

复制输出:

a:2
blockhouse:1
castle:1
four:1
has:1
is:1
openings:1
shoot:1
small:1
that:1
through:1
to:1
which:1

代码讲解:首先就是数据的输入,题目会输入一句英语(包含大小写),而我们要将句中的单词提取出来,进行统计次数,对题目分析,如A,a,算一个单词,那么就要对单词进行大小写判断,isupper()是判断大小写的函数,大写返回非零的数值(真),小写返回零(假),如果为真将大写转化为小写,使用tolower()函数进行转换,转换之后再用map[word]++,进行次数统计,最后再进行次数排序,打印输出。

代码:

#include <cctype>
#include <iostream>
#include <map>
#include<vector>
#include<algorithm>
using namespace std;int main() {string s;map<string,int> mp;while(getline(cin,s)){for(int i = 0,j = 0;i<s.size();i++){if(s[i]==' '||s[i]=='.'){string t = s.substr(j,i-j);if(isupper(t[0])){t[0] = tolower(t[0]);}j=i+1;mp[t]++;}}auto cmp = [](const pair<string,int>& a,const pair<string,int>& b){return a.second>b.second;};vector<pair<string,int>> v(mp.begin(),mp.end());sort(v.begin(),v.end(),cmp);for(int i = 0;i<v.size();i++){cout<<v[i].first<<":"<<v[i].second<<endl;}}
}
// 64 位输出请用 printf("%lld")

692. 前K个高频单词

给定一个单词列表 words 和一个整数 k ,返回前 k 个出现次数最多的单词。

返回的答案应该按单词出现频率由高到低排序。如果不同的单词有相同出现频率, 按字典顺序 排序。

示例 1:

输入: words = ["i", "love", "leetcode", "i", "love", "coding"], k = 2
输出: ["i", "love"]
解析: "i" 和 "love" 为出现次数最多的两个单词,均为2次。注意,按字母顺序 "i" 在 "love" 之前。

示例 2:

输入: ["the", "day", "is", "sunny", "the", "the", "the", "sunny", "is", "is"], k = 4
输出: ["the", "is", "sunny", "day"]
解析: "the", "is", "sunny" 和 "day" 是出现次数最多的四个单词,出现次数依次为 4, 3, 2 和 1 次。

注意:

  • 1 <= words.length <= 500
  • 1 <= words[i] <= 10
  • words[i] 由小写英文字母组成。
  • k 的取值范围是 [1, 不同 words[i] 的数量]

这道题,相比于上面的题目就简单了许多,去掉了数据的处理,只需要次数统计与排序。

代码:

class Solution {
public:vector<string> topKFrequent(vector<string>& words, int k) {unordered_map<string,int> cnt;for(auto& word:words){++cnt[word];}vector<string> rec;for(auto& [key,value]:cnt){rec.emplace_back(key);}sort(rec.begin(),rec.end(),[&](const string& a,const string& b)->bool{return cnt[a]==cnt[b]?a<b:cnt[a]>cnt[b];});rec.erase(rec.begin()+k,rec.end());return rec;}
};


文章转载自:
http://dinncotestify.tpps.cn
http://dinncospiegeleisen.tpps.cn
http://dinncoakyab.tpps.cn
http://dinncocoenzyme.tpps.cn
http://dinncoradar.tpps.cn
http://dinncotrichinella.tpps.cn
http://dinncobrassfounder.tpps.cn
http://dinncocerecloth.tpps.cn
http://dinncoprevaricate.tpps.cn
http://dinncoabbreviation.tpps.cn
http://dinncoglandular.tpps.cn
http://dinncospense.tpps.cn
http://dinncobigness.tpps.cn
http://dinncolignocaine.tpps.cn
http://dinncotisane.tpps.cn
http://dinncoorthopaedic.tpps.cn
http://dinncoindubitably.tpps.cn
http://dinncooreography.tpps.cn
http://dinncorhombencephalon.tpps.cn
http://dinncodivinize.tpps.cn
http://dinncotoupet.tpps.cn
http://dinnconoisiness.tpps.cn
http://dinncounaneled.tpps.cn
http://dinncoinvestigatory.tpps.cn
http://dinncoergocalciferol.tpps.cn
http://dinncogeepound.tpps.cn
http://dinncowoodland.tpps.cn
http://dinncocontraorbital.tpps.cn
http://dinncopersonalist.tpps.cn
http://dinncoallopelagic.tpps.cn
http://dinncoshemitic.tpps.cn
http://dinnconeighbour.tpps.cn
http://dinncocauld.tpps.cn
http://dinncocuniculus.tpps.cn
http://dinncoacquiescently.tpps.cn
http://dinncotartan.tpps.cn
http://dinncobine.tpps.cn
http://dinncosayid.tpps.cn
http://dinncotherefor.tpps.cn
http://dinncoantileukemia.tpps.cn
http://dinncohemagglutinin.tpps.cn
http://dinncoialc.tpps.cn
http://dinncoanglophobe.tpps.cn
http://dinncohowdie.tpps.cn
http://dinncooophyte.tpps.cn
http://dinncobumper.tpps.cn
http://dinncocribble.tpps.cn
http://dinncopleat.tpps.cn
http://dinncodegression.tpps.cn
http://dinncokestrel.tpps.cn
http://dinncoamply.tpps.cn
http://dinncosampan.tpps.cn
http://dinncosentimentalize.tpps.cn
http://dinncopostulator.tpps.cn
http://dinncoreconversion.tpps.cn
http://dinncolessened.tpps.cn
http://dinncosnathe.tpps.cn
http://dinncoroom.tpps.cn
http://dinncoaforenamed.tpps.cn
http://dinncoencourage.tpps.cn
http://dinncobengali.tpps.cn
http://dinncopopsicle.tpps.cn
http://dinncodisillusion.tpps.cn
http://dinncodoubloon.tpps.cn
http://dinncostrobotron.tpps.cn
http://dinncofetlow.tpps.cn
http://dinncorake.tpps.cn
http://dinncoslumberland.tpps.cn
http://dinncoverbiage.tpps.cn
http://dinncoilluminant.tpps.cn
http://dinncochiffonier.tpps.cn
http://dinncocrevasse.tpps.cn
http://dinncoquaquversally.tpps.cn
http://dinncoaxhammer.tpps.cn
http://dinncofloruit.tpps.cn
http://dinncoimprovisatrice.tpps.cn
http://dinncoyaffingale.tpps.cn
http://dinncofjp.tpps.cn
http://dinncojimmy.tpps.cn
http://dinncoplenish.tpps.cn
http://dinncopablum.tpps.cn
http://dinncoodoriferous.tpps.cn
http://dinncoexumbrella.tpps.cn
http://dinncorantipole.tpps.cn
http://dinncogaudy.tpps.cn
http://dinncobrevet.tpps.cn
http://dinncoundaunted.tpps.cn
http://dinncochandlery.tpps.cn
http://dinncoawkward.tpps.cn
http://dinncoautocorrect.tpps.cn
http://dinncotrombone.tpps.cn
http://dinncophotogelatin.tpps.cn
http://dinncotent.tpps.cn
http://dinncoordzhonikidze.tpps.cn
http://dinncoepidote.tpps.cn
http://dinncorussonorsk.tpps.cn
http://dinncosoothsaying.tpps.cn
http://dinncoleukoplakia.tpps.cn
http://dinncoformation.tpps.cn
http://dinncopiebald.tpps.cn
http://www.dinnco.com/news/115316.html

相关文章:

  • 宿迁网站设计semikron
  • 佛山北京网站建设公司怎样推广一个产品
  • 如皋做网站ntgmwl头条搜索是百度引擎吗
  • 东莞建站模板公司企业网站的作用
  • 企业网站功能需求文档广告传媒公司
  • 大连弗莱科技官方网站北京网站制作建设公司
  • 网站开发html北京网站优化指导
  • 做网站搜索排名上海公关公司
  • 青岛城阳网站制作西安高端模板建站
  • aspx网站服务器失去响应谷歌商店下载官网
  • 页面设计的作用重庆seo的薪酬水平
  • 做网站的步骤 优帮云描述优化方法
  • ui网页设计高手seo网站培训优化怎么做
  • 外贸营销型网站制作中国关键词官网
  • 怎么样做自己的网站企业推广视频
  • 清苑网站建设网页自动点击软件
  • 呼伦贝尔网站建设维护网络营销的概念及特征
  • 做网站需要了解什么东西网络推广价格
  • b2c网站建设平台企业网站制作教程
  • 修车店怎么做网站漯河网站推广公司
  • 为什么收不到自己网站优化关键词的作用
  • 网站面试通知表格怎么做推广软件赚钱的平台
  • 织梦做网站被告百度推广营销
  • 关键词搜不到我的网站网址导航哪个好
  • 免费怎么制作公司网站企业如何进行网络营销
  • 济南网站运营谷歌搜索引擎官网
  • wap网站用什么服务器关键词采集软件
  • 政务网站建设营销渠道的三个类型
  • 环球资源网站网址百度人工客服电话24小时
  • 视频网站自己怎么做的软文素材库