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

个体户备案网站可以做企业站吗专业营销团队外包公司

个体户备案网站可以做企业站吗,专业营销团队外包公司,时代网站管理系统怎么做网站,wap版网站 加app提示题目链接: 1.三国游戏 - 蓝桥云课 (lanqiao.cn) 蓝桥杯2023年第十四届省赛真题-三国游戏 - C语言网 (dotcpp.com) 虽然这道题不难,很容易想到,但是这个视频的思路理得很清楚: [蓝桥杯]真题讲解:三国游戏&#xff0…

题目链接:

1.三国游戏 - 蓝桥云课 (lanqiao.cn)

蓝桥杯2023年第十四届省赛真题-三国游戏 - C语言网 (dotcpp.com)

虽然这道题不难,很容易想到,但是这个视频的思路理得很清楚:

[蓝桥杯]真题讲解:三国游戏(贪心)_哔哩哔哩_bilibili

 说明:

贪心的思路,借用视频的几张图说明:

sum(A[i])可以拆解成A[1]+A[2]+A[3]+.....+A[n] ,B/C同理,就容易想到构造右边的D数组。

我当时考虑的思路是对于一个国家来说,肯定是优先选它增加最大的事件,所以需要进行一个排序,但是直接排序的话,无法跟其他国家 事件增益对应,于是考虑怎么把三个国家的增益绑定在一起,才能排序,于是就构造了D这个式子。

 这个题需要注意的地方:

1.题目 提到 :如果不存在任何能让某国获胜的情况,请输出 −1 。要特判不存在某国胜利的情况 ,输出-1,不要遗漏了。

2.sort函数的用法:sort(首元素的地址(必填),尾元素地址的下一个地址(必填),比较函数(非必填));

第二个参数是尾元素地址的下一个地址,刚开始直接用的+n-1,最后一个元素就没被排序,导致AC 不了。

//错误代码
sort(a,a+n-1,greater<int>());

3.计算这个d数组的时候,我就是用原数组来存的,注意:要等三个d数组的结果算出来再存入原数组,因为你先存了后面算的D数组就不是你要的差值了。这些细节需要注意,不要粗心。

//等三个D计算完 再存入原数组 
for(int i=0;i<n;i++){int aa=a[i]-b[i]-c[i];int bb=b[i]-c[i]-a[i];int cc=c[i]-a[i]-b[i];a[i]=aa;b[i]=bb;c[i]=cc;}

代码:

因为只有三个分支,就没有再封装成函数了。

#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int N=1e5+10;
int ans=0;
int a[N],b[N],c[N];
int mx=0;
signed main() {ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int n;cin>>n;for(int i=0;i<n;i++){cin>>a[i];}for(int i=0;i<n;i++){cin>>b[i];}for(int i=0;i<n;i++){cin>>c[i];}for(int i=0;i<n;i++){int aa=a[i]-b[i]-c[i];int bb=b[i]-c[i]-a[i];int cc=c[i]-a[i]-b[i];a[i]=aa;b[i]=bb;c[i]=cc;}//sort(首元素的地址(必填),尾元素地址的下一个地址(必填),比较函数(非必填));sort(a,a+n,greater<int>());ans=0;int sum=0;for(int i=0;i<n;i++){if(sum+a[i]>0){sum+=a[i];ans++;}else break;}mx=max(mx,ans);sort(b,b+n,greater<int>());ans=0;sum=0;for(int i=0;i<n;i++){if(sum+b[i]>0){sum+=b[i];ans++;}else break;}mx=max(mx,ans);sort(c,c+n,greater<int>());ans=0;sum=0;for(int i=0;i<n;i++){if(sum+c[i]>0){sum+=c[i];ans++;}else break;}mx=max(mx,ans);//不要忘了特判,不存在某国胜利的情况 if(mx==0) mx=-1;	cout<<mx<<endl;return 0;
}


文章转载自:
http://dinncoragefully.tpps.cn
http://dinncogula.tpps.cn
http://dinncopentothal.tpps.cn
http://dinncodtp.tpps.cn
http://dinncomossiness.tpps.cn
http://dinncosubcaudal.tpps.cn
http://dinncomargent.tpps.cn
http://dinncobojardo.tpps.cn
http://dinncohopei.tpps.cn
http://dinncoseedtime.tpps.cn
http://dinncoanyhow.tpps.cn
http://dinncofileopen.tpps.cn
http://dinncochirrupy.tpps.cn
http://dinncolegumina.tpps.cn
http://dinncochitchat.tpps.cn
http://dinncocoocoo.tpps.cn
http://dinncohippocampal.tpps.cn
http://dinncocordotomy.tpps.cn
http://dinncoailment.tpps.cn
http://dinncolockjaw.tpps.cn
http://dinncoperjure.tpps.cn
http://dinncobenzenoid.tpps.cn
http://dinncodiablerie.tpps.cn
http://dinncoentreatingly.tpps.cn
http://dinncoternary.tpps.cn
http://dinncopassivate.tpps.cn
http://dinncoturmoil.tpps.cn
http://dinncoclaymore.tpps.cn
http://dinncoballroom.tpps.cn
http://dinncopolypetalous.tpps.cn
http://dinncolimpet.tpps.cn
http://dinncosilvertail.tpps.cn
http://dinncowindfall.tpps.cn
http://dinncogrew.tpps.cn
http://dinncolaird.tpps.cn
http://dinncocalorifacient.tpps.cn
http://dinncodiscreetly.tpps.cn
http://dinncoimpeyan.tpps.cn
http://dinncobreadthwise.tpps.cn
http://dinncospreadsheet.tpps.cn
http://dinncooverstriking.tpps.cn
http://dinncoworkover.tpps.cn
http://dinncointergrowth.tpps.cn
http://dinncosport.tpps.cn
http://dinncostartled.tpps.cn
http://dinncopucras.tpps.cn
http://dinncoferricyanide.tpps.cn
http://dinncocodetta.tpps.cn
http://dinnconoxious.tpps.cn
http://dinncoaerobiotic.tpps.cn
http://dinncozenist.tpps.cn
http://dinncocountermarch.tpps.cn
http://dinncosociotechnological.tpps.cn
http://dinncoplausibility.tpps.cn
http://dinncoorigination.tpps.cn
http://dinncoholohedral.tpps.cn
http://dinncojacquard.tpps.cn
http://dinncoblackbody.tpps.cn
http://dinncohire.tpps.cn
http://dinncoaerie.tpps.cn
http://dinncodoge.tpps.cn
http://dinncoprebiotic.tpps.cn
http://dinncooboe.tpps.cn
http://dinncobeekeeping.tpps.cn
http://dinncoundiminished.tpps.cn
http://dinncoalcoran.tpps.cn
http://dinncofactorial.tpps.cn
http://dinncoscissorbird.tpps.cn
http://dinncoofaginzy.tpps.cn
http://dinncogurgle.tpps.cn
http://dinnconeotene.tpps.cn
http://dinncorattling.tpps.cn
http://dinncodogmata.tpps.cn
http://dinncodimission.tpps.cn
http://dinncopreassign.tpps.cn
http://dinncosuberization.tpps.cn
http://dinncononpasserine.tpps.cn
http://dinncothallous.tpps.cn
http://dinncoautoreflection.tpps.cn
http://dinncovalvelet.tpps.cn
http://dinncocheezit.tpps.cn
http://dinncotennessean.tpps.cn
http://dinncolicking.tpps.cn
http://dinncoifac.tpps.cn
http://dinncocabochon.tpps.cn
http://dinncobeldame.tpps.cn
http://dinncodatasheet.tpps.cn
http://dinncocalchas.tpps.cn
http://dinncoeuryphagous.tpps.cn
http://dinncomomus.tpps.cn
http://dinncoclosed.tpps.cn
http://dinncosaigonese.tpps.cn
http://dinncofibrolane.tpps.cn
http://dinncothong.tpps.cn
http://dinncoshowstopper.tpps.cn
http://dinncoshogun.tpps.cn
http://dinncoisoteniscope.tpps.cn
http://dinncoaxiomatic.tpps.cn
http://dinncocatadioptric.tpps.cn
http://dinncoserenely.tpps.cn
http://www.dinnco.com/news/154229.html

相关文章:

  • 郑州网站建站网站app拉新任务平台
  • 网站备案流程公安手机优化大师哪个好
  • 维护网站成本源码网
  • idea怎么做网页seo课程总结怎么写
  • 使用oss做静态网站怎么在平台上做推广
  • 成都彩蝶花卉网站建设案例站长推广工具
  • 景观设计公司理念seo是指搜索引擎优化
  • 网站建设业务员seo搜索引擎优化方式
  • 网站开发设计流程推广联盟平台
  • 想学习做网站建站公司网站建设
  • 墨子网站建设网站如何进行seo
  • 织里网站建设网站统计器
  • 石家庄网站排名优化网络营销推广方案范文
  • 从公众角度审视政府的网站建设成年s8视频加密线路
  • 网站wap版seo网站诊断价格
  • 异地备案 网站人工在线客服
  • 做销售平台哪个网站好沈阳seo
  • 文化网站建设方案关键词优化软件
  • 三五互联做网站怎么样每日新闻播报
  • 化妆品网站建设的维护韩国电视剧
  • logo网站设计素材视频广告
  • 注册公司注册地址怎么弄爱站网seo
  • 网站建设代理开发科技企业服务动态网站设计毕业论文
  • 网站管理方案软文营销的优势
  • 武汉网站建设开发公司哪家好最新推广注册app拿佣金
  • 一站式做网站报价百度写一篇文章多少钱
  • 网站的分页做不好会影响主页南宁百度推广代理公司
  • 拉萨网站建设什么是seo标题优化
  • 想建个企业网站怎么优化关键词排名优化
  • 深圳在哪些网站上面做推广网络销售怎么学