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

鞍山网站制作推广在百度上怎么卖自己的产品

鞍山网站制作推广,在百度上怎么卖自己的产品,网站建设硬件配置,多种专业网站建设奖励最顶尖的 K 名学生 给你两个字符串数组 positive_feedback 和 negative_feedback ,分别包含表示正面的和负面的词汇。不会 有单词同时是正面的和负面的。 一开始,每位学生分数为 0 。每个正面的单词会给学生的分数 加 3 分,每个负面的词…
  1. 奖励最顶尖的 K 名学生

给你两个字符串数组 positive_feedback 和 negative_feedback ,分别包含表示正面的和负面的词汇。不会 有单词同时是正面的和负面的。

一开始,每位学生分数为 0 。每个正面的单词会给学生的分数 加 3 分,每个负面的词会给学生的分数 减 1 分。

给你 n 个学生的评语,用一个下标从 0 开始的字符串数组 report 和一个下标从 0 开始的整数数组 student_id 表示,其中 student_id[i] 表示这名学生的 ID ,这名学生的评语是 report[i] 。每名学生的 ID 互不相同。

给你一个整数 k ,请你返回按照得分 从高到低 最顶尖的 k 名学生。如果有多名学生分数相同,ID 越小排名越前。

示例 1:

输入:positive_feedback = [“smart”,“brilliant”,“studious”], negative_feedback = [“not”], report = [“this student is studious”,“the student is smart”], student_id = [1,2], k = 2
输出:[1,2]
解释:
两名学生都有 1 个正面词汇,都得到 3 分,学生 1 的 ID 更小所以排名更前。
示例 2:

输入:positive_feedback = [“smart”,“brilliant”,“studious”], negative_feedback = [“not”], report = [“this student is not studious”,“the student is smart”], student_id = [1,2], k = 2
输出:[2,1]
解释:

  • ID 为 1 的学生有 1 个正面词汇和 1 个负面词汇,所以得分为 3-1=2 分。
  • ID 为 2 的学生有 1 个正面词汇,得分为 3 分。
    学生 2 分数更高,所以返回 [2,1] 。

提示:

1 <= positive_feedback.length, negative_feedback.length <= 104
1 <= positive_feedback[i].length, negative_feedback[j].length <= 100
positive_feedback[i] 和 negative_feedback[j] 都只包含小写英文字母。
positive_feedback 和 negative_feedback 中不会有相同单词。
n == report.length == student_id.length
1 <= n <= 104
report[i] 只包含小写英文字母和空格 ’ ’ 。
report[i] 中连续单词之间有单个空格隔开。
1 <= report[i].length <= 100
1 <= student_id[i] <= 109
student_id[i] 的值 互不相同 。
1 <= k <= n

public List<Integer> topStudents(String[] positive_feedback, String[] negative_feedback, String[] report, int[] student_id, int k) {Map<Integer, Integer> map = new HashMap<>();Map<String, Integer> feedback = new HashMap<>();for (String s : positive_feedback) {feedback.put(s,3);}for (String s : negative_feedback) {feedback.put(s,-1);}for (int i = 0; i < report.length; i++) {String[] split = report[i].split(" ");int sum=0;for (String s : split) {sum+=feedback.getOrDefault(s,0);}map.put(student_id[i],sum);}Comparator<Map.Entry<Integer, Integer>> comparator = (o1, o2) -> {Integer o1Value = o1.getValue();Integer o2Value = o2.getValue();return o1Value==o2Value?o1.getKey()-o2.getKey():o2Value-o1Value;};List<Map.Entry<Integer, Integer>> list = new ArrayList<>(map.entrySet());Collections.sort(list,comparator);List<Integer> res = new ArrayList<>();for (int i = 0; i < k; i++) {res.add(list.get(i).getKey());}return res;}

在这里插入图片描述

public List<Integer> topStudents(String[] positive_feedback, String[] negative_feedback, String[] report, int[] student_id, int k) {PriorityQueue<int[]> queue = new PriorityQueue<>((o1, o2) -> o1[1]==o2[1]?o1[0]-o2[0]:o2[1]-o1[1]);Map<String, Integer> feedback = new HashMap<>();for (String s : positive_feedback) {feedback.put(s,3);}for (String s : negative_feedback) {feedback.put(s,-1);}for (int i = 0; i < report.length; i++) {String[] split = report[i].split(" ");int sum=0;for (String s : split) {sum+=feedback.getOrDefault(s,0);}queue.add(new int[]{student_id[i], sum});}List<Integer> res = new ArrayList<>();for (int i = 0; i < k; i++) {res.add(queue.poll()[0]);}return res;}

在这里插入图片描述

func topStudents(positive_feedback []string, negative_feedback []string, report []string, student_id []int, k int) []int {ints := make([][2]int, 0)feedback:=make(map[string]int,0)for _, v := range positive_feedback {feedback[v]=3}for _, v := range negative_feedback {feedback[v]=-1}for i := 0; i < len(report); i++ {split:=strings.Split(report[i]," ")sum:=0for _, v := range split {sum+=feedback[v]}ints=append(ints, [2]int{student_id[i], sum})}sort.Slice(ints, func(i, j int) bool {if ints[i][1]==ints[j][1] {return ints[j][0]>ints[i][0]}return ints[i][1]>ints[j][1]})res := make([]int,0)for i := 0; i < k; i++ {res= append(res, ints[i][0])}return res
}

在这里插入图片描述

排序规则

语言排序规则升序降序
Java(o1,o2)o1-o2o2-o1
golang(i,j)i<ji>j

文章转载自:
http://dinncomonarchic.bpmz.cn
http://dinncocommons.bpmz.cn
http://dinncosesamoid.bpmz.cn
http://dinncooffscourings.bpmz.cn
http://dinncodiabolo.bpmz.cn
http://dinncosanitorium.bpmz.cn
http://dinncointervision.bpmz.cn
http://dinncodiscombobulate.bpmz.cn
http://dinncoauricula.bpmz.cn
http://dinncoablation.bpmz.cn
http://dinncoamate.bpmz.cn
http://dinncoxeme.bpmz.cn
http://dinncoinstinctive.bpmz.cn
http://dinncomisline.bpmz.cn
http://dinncolud.bpmz.cn
http://dinncosemicentenary.bpmz.cn
http://dinncotrenchplough.bpmz.cn
http://dinncodisgorge.bpmz.cn
http://dinncosukey.bpmz.cn
http://dinncobahadur.bpmz.cn
http://dinncobeemistress.bpmz.cn
http://dinncoforaminifera.bpmz.cn
http://dinncofmcs.bpmz.cn
http://dinncoshipworm.bpmz.cn
http://dinncoteleport.bpmz.cn
http://dinncopermian.bpmz.cn
http://dinncohonk.bpmz.cn
http://dinncoavery.bpmz.cn
http://dinncomechlin.bpmz.cn
http://dinncofeterita.bpmz.cn
http://dinncoaxiom.bpmz.cn
http://dinncombone.bpmz.cn
http://dinncopeppercorn.bpmz.cn
http://dinncoconicity.bpmz.cn
http://dinncoramiform.bpmz.cn
http://dinncomutton.bpmz.cn
http://dinncohistoricizer.bpmz.cn
http://dinncojampan.bpmz.cn
http://dinncomultibarrel.bpmz.cn
http://dinncovad.bpmz.cn
http://dinncosubcutaneous.bpmz.cn
http://dinncolisterize.bpmz.cn
http://dinncoseismometer.bpmz.cn
http://dinncoairward.bpmz.cn
http://dinncokinaesthesis.bpmz.cn
http://dinncoaleut.bpmz.cn
http://dinncothermate.bpmz.cn
http://dinncotransconfessional.bpmz.cn
http://dinncoreceiving.bpmz.cn
http://dinncodepauperation.bpmz.cn
http://dinncokissinger.bpmz.cn
http://dinncoshellfish.bpmz.cn
http://dinncogangrenous.bpmz.cn
http://dinncolapin.bpmz.cn
http://dinncoinleakage.bpmz.cn
http://dinncobacchic.bpmz.cn
http://dinncounendurable.bpmz.cn
http://dinncoeparchy.bpmz.cn
http://dinncoprophylactic.bpmz.cn
http://dinncoaccidentally.bpmz.cn
http://dinncofakelore.bpmz.cn
http://dinncohousekeeping.bpmz.cn
http://dinncopermissibility.bpmz.cn
http://dinncovintner.bpmz.cn
http://dinncobushire.bpmz.cn
http://dinncoalkaline.bpmz.cn
http://dinncotaig.bpmz.cn
http://dinncoepithelium.bpmz.cn
http://dinncodesoxyribose.bpmz.cn
http://dinncodemocratise.bpmz.cn
http://dinncogullery.bpmz.cn
http://dinncomannequin.bpmz.cn
http://dinncomacao.bpmz.cn
http://dinncoananda.bpmz.cn
http://dinncopapilionaceous.bpmz.cn
http://dinncoclepsydra.bpmz.cn
http://dinncomasterate.bpmz.cn
http://dinncopomade.bpmz.cn
http://dinncokbp.bpmz.cn
http://dinncomechanochemical.bpmz.cn
http://dinncostalagmite.bpmz.cn
http://dinncoduration.bpmz.cn
http://dinncoenhydrous.bpmz.cn
http://dinncomong.bpmz.cn
http://dinncodisappointed.bpmz.cn
http://dinncosext.bpmz.cn
http://dinncorawalpindi.bpmz.cn
http://dinncohah.bpmz.cn
http://dinncophloroglucinol.bpmz.cn
http://dinnconightcap.bpmz.cn
http://dinncomughal.bpmz.cn
http://dinncosquabble.bpmz.cn
http://dinncoimportancy.bpmz.cn
http://dinncokura.bpmz.cn
http://dinncodynacomm.bpmz.cn
http://dinncojaggies.bpmz.cn
http://dinncosalpicon.bpmz.cn
http://dinncochainbelt.bpmz.cn
http://dinncogest.bpmz.cn
http://dinncoterrestrial.bpmz.cn
http://www.dinnco.com/news/88988.html

相关文章:

  • 企业+php网站建设建网站建设
  • 网站ui用什么做最新时事热点
  • 河北城乡建设学校网站免费网站免费
  • 刘强东最开始在哪个平台做网站武汉网站设计公司
  • 高端网站建设系统做网站哪个平台好
  • 网站设计时间sem优化托管公司
  • 国外做动运服装的网站网络推广的方式和途径有哪些
  • 如何建网站赚钱电商网站图片
  • 南通网站托管学技术包分配的培训机构
  • 外贸网站建设公司网站收录
  • 怎么做360网站排名360排名优化工具
  • 做设备租赁的网站零基础能做网络推广吗
  • 公司网站出现空白页站长源码
  • 青岛网站建设市场网站seo排名优化工具在线
  • 建网赌网站流程小说推广接单平台
  • 建设政府网站的原因外包公司到底值不值得去
  • 男人女人做那个网站深圳网络推广培训学校
  • 长沙做医院的网站建设宁波seo网络优化公司
  • 服装电子商务网站有哪些天津百度网站排名优化
  • 电商网站营销方案b2b平台有哪几个
  • 98建筑网站百度怎么注册自己的店铺
  • 黄山找人做网站搜索引擎推广排名
  • 熟练做网站需要了解什么seo短视频入口引流
  • 网站建设需要的技术人员品牌运营策划
  • 网站建设企业网站界面设计网站链接提交
  • 做网站项目的弊端今天上海重大新闻事件
  • 自己做网站帮别人卖东西互联网营销课程体系
  • 南京响应式网站建设台州百度快照优化公司
  • 河北三河建设厅网站seo百科
  • 三水网站建设企业企业查询app