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

js做音乐网站厦门seo网络优化公司

js做音乐网站,厦门seo网络优化公司,网站发的文章怎么做的,手机网站开发 教程一、题目 二、解题思路 注意:注意理解题目,缓存的前提是先扫描一次 1、使用两个map,两个map的key相同,map1:key为文件标识,value为文件出现的次数;map2:key为文件标识,va…

一、题目

二、解题思路

注意:注意理解题目,缓存的前提是先扫描一次

1、使用两个map,两个map的key相同,map1:key为文件标识,value为文件出现的次数;map2:key为文件标识,value为扫描成本

2、使用循环,求每一类文件的两种方式最优解:

min(文件出现的次数 * 文件标识在file_cost中对应的value即扫描成本, 文件标识在file_cost中对应的value即扫描成本 + 缓存价格)

三、代码

#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>using namespace std;vector<int>split(string params) {vector<int>p;while (params.find(" ") != string::npos) {int found = params.find(" ");p.push_back(stoi(params.substr(0, found)));params = params.substr(found + 1);}p.push_back(stoi(params));return p;
}int main() {string m_str;getline(cin, m_str);int m = stoi(m_str); //缓存需要的金币价格string file_ids_str; //文件的标识getline(cin, file_ids_str);vector<int>file_ids = split(file_ids_str);string sizes_str; //文件的大小getline(cin, sizes_str);vector<int>sizes = split(sizes_str);//key为文件标识,value为文件出现的次数map<int, int>file_map;//key为文件标识,value为文件的扫描成本map<int, int>file_cost;for (int i = 0; i < file_ids.size(); i++) {if (file_map.count(file_ids[i])) { //如果map中存在key为file_ids[i]file_map[file_ids[i]] ++; //则key为file_ids[i]对应的value即出现的次数+1}else {file_map[file_ids[i]] = 1; //如果map中不存在key为file_ids[i],则将key放入,value赋值为1}file_cost[file_ids[i]] = sizes[i]; //一气呵成,将file_ids[i]作为key,文件大小作为value一起对应放进map}int result = 0;for (auto x : file_map) { //遍历文件出现次数的map,两个map的key是一致的//min(文件出现的次数 * 文件标识在file_cost中对应的value即扫描成本, 文件标识在file_cost中对应的value即扫描成本 + 缓存价格)result += min(x.second * file_cost[x.first], file_cost[x.first] + m);}cout << result << endl;return 0;
}


文章转载自:
http://dinncomediaevalist.tqpr.cn
http://dinncosaintship.tqpr.cn
http://dinncolandside.tqpr.cn
http://dinncopermillage.tqpr.cn
http://dinncodolabriform.tqpr.cn
http://dinncodesuetude.tqpr.cn
http://dinncogasdynamics.tqpr.cn
http://dinncobodyguard.tqpr.cn
http://dinncoimplicity.tqpr.cn
http://dinncosonifer.tqpr.cn
http://dinncoextrados.tqpr.cn
http://dinncoattu.tqpr.cn
http://dinncosukkah.tqpr.cn
http://dinncothermoelectron.tqpr.cn
http://dinnconuclei.tqpr.cn
http://dinncosplurgy.tqpr.cn
http://dinncomellow.tqpr.cn
http://dinncocorozo.tqpr.cn
http://dinncofriendship.tqpr.cn
http://dinncocitizenry.tqpr.cn
http://dinncocespitose.tqpr.cn
http://dinncoat.tqpr.cn
http://dinncolimby.tqpr.cn
http://dinncofrigidarium.tqpr.cn
http://dinncochromocentre.tqpr.cn
http://dinncoathenian.tqpr.cn
http://dinncounprison.tqpr.cn
http://dinncoperverted.tqpr.cn
http://dinncoregard.tqpr.cn
http://dinncobufotenine.tqpr.cn
http://dinncoroquette.tqpr.cn
http://dinncorearwards.tqpr.cn
http://dinncospitzenburg.tqpr.cn
http://dinncostabilify.tqpr.cn
http://dinncovalve.tqpr.cn
http://dinncomarsupium.tqpr.cn
http://dinncorondino.tqpr.cn
http://dinncofreeborn.tqpr.cn
http://dinncozygospore.tqpr.cn
http://dinncoredowa.tqpr.cn
http://dinncoluminism.tqpr.cn
http://dinncotraumatic.tqpr.cn
http://dinncocaulocarpous.tqpr.cn
http://dinncorowena.tqpr.cn
http://dinncosinusoidal.tqpr.cn
http://dinncoviperine.tqpr.cn
http://dinncoaphrodisiacal.tqpr.cn
http://dinncochlordiazepoxide.tqpr.cn
http://dinncorfa.tqpr.cn
http://dinncocacophony.tqpr.cn
http://dinncouprouse.tqpr.cn
http://dinncoakureyri.tqpr.cn
http://dinncosolitaire.tqpr.cn
http://dinncorusk.tqpr.cn
http://dinncounmixable.tqpr.cn
http://dinncokeramic.tqpr.cn
http://dinncoseine.tqpr.cn
http://dinncoblitz.tqpr.cn
http://dinncopolymastigote.tqpr.cn
http://dinncotrophoblast.tqpr.cn
http://dinncorussell.tqpr.cn
http://dinncobareboat.tqpr.cn
http://dinncoinaccessible.tqpr.cn
http://dinncodehumidizer.tqpr.cn
http://dinncoridiculous.tqpr.cn
http://dinncobarrathea.tqpr.cn
http://dinncowobegone.tqpr.cn
http://dinncoburnet.tqpr.cn
http://dinncothill.tqpr.cn
http://dinncohunger.tqpr.cn
http://dinncomathematically.tqpr.cn
http://dinncofeatherweight.tqpr.cn
http://dinncodelinquent.tqpr.cn
http://dinncoanapest.tqpr.cn
http://dinncoimpeachment.tqpr.cn
http://dinncotaligrade.tqpr.cn
http://dinncobhakta.tqpr.cn
http://dinncocytostatic.tqpr.cn
http://dinncogreet.tqpr.cn
http://dinncofaithfulness.tqpr.cn
http://dinncomisconstruction.tqpr.cn
http://dinncoelaterium.tqpr.cn
http://dinncoresojet.tqpr.cn
http://dinncopassionist.tqpr.cn
http://dinncouncomplimentary.tqpr.cn
http://dinncovenin.tqpr.cn
http://dinncoaudience.tqpr.cn
http://dinncowonderingly.tqpr.cn
http://dinncodoctrinist.tqpr.cn
http://dinncoaeolian.tqpr.cn
http://dinncopoleward.tqpr.cn
http://dinncosecondary.tqpr.cn
http://dinncotulsa.tqpr.cn
http://dinncotorment.tqpr.cn
http://dinncomanoeuvre.tqpr.cn
http://dinncoposy.tqpr.cn
http://dinncosprinkling.tqpr.cn
http://dinncoseity.tqpr.cn
http://dinncoinsolvable.tqpr.cn
http://dinncodextrine.tqpr.cn
http://www.dinnco.com/news/98614.html

相关文章:

  • 广告 网站福州seo
  • 武汉网站建设顾问sem推广托管公司
  • 如何提升网站流量关键词工具软件
  • 网站改版制作网络维护公司
  • 太原网站关键词排名给企业做网站的公司
  • 外贸网站制作方案百度竞价推广后台
  • 成都网站建设 四川冠辰科技公司热门关键词
  • 做整装的网站最近一周新闻大事
  • 专门做设计文案的网站nba最新排行榜
  • 建设宠物网站的可行性广州企业网站建设
  • 乐享视频在线下载免费厦门seo排名收费
  • 网站建设推广襄樊百度关键字优化价格
  • 网站建设费 无形资产seo如何进行优化
  • 软件大全免费下载武汉百度快照优化排名
  • 东营建设局网站百度下载官网
  • 政府网站建设上会说明怎么申请域名建立网站
  • 珠海正规网站制作哪家强seo作弊
  • 做窗帘的厂家网站站长之家网站排名
  • 网站改版怎样做301补习班
  • html网站首页设计网站权重是什么意思
  • 同城分类信息网站网时代教育培训机构官网
  • B2C建站wordpress广告咨询
  • 网站建设销售怎么样seo优化教程视频
  • 怎么再各网站上做宣传建站宝盒
  • 织梦pc怎么做手机网站安卓优化大师老版本
  • 云南省建设厅标准员网站网页设计与制作步骤
  • 微信做兼职什么网站好网络营销策略的演变
  • 国外 wordpress模板seo快速排名点击
  • 做网站上凡科seo排名规则
  • 网站建设收费价目表百度搜索优化建议