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

手机网站开发人员选项手机端搜索引擎排名

手机网站开发人员选项,手机端搜索引擎排名,三亚网站建设报价,做国际贸易的网站文章目录 一、题目A.召唤神坤基本思路:代码 B.聪明的交换策略基本思路:代码 C.怪兽突击基本思路:代码 D.蓝桥快打基本思路代码 一、题目 A.召唤神坤 基本思路: 贪心, 使结果最大,希望两边w[i],w[k]是较大…

文章目录

  • 一、题目
    • A.召唤神坤
      • 基本思路:
      • 代码
    • B.聪明的交换策略
      • 基本思路:
      • 代码
    • C.怪兽突击
      • 基本思路:
      • 代码
    • D.蓝桥快打
      • 基本思路
      • 代码


一、题目

A.召唤神坤

基本思路:

  • 贪心, 使结果最大,希望两边w[i],w[k]是较大的,中间w[j]是较小的

代码

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long
#define repn(i,a,n) for(int i = a; i <= n; i++)
#define rep(i,a,n) for(int i = a; i < n; i++)
typedef pair<int,int> PII; 
const int N = 2e6+10;
int n,a[N],b[N];void solve(){cin>>n;repn(i,1,n) cin>>a[i];//贪心, 使结果最大,希望两边w[i],w[k]是较大的,中间w[j]是较小的//先算出并保存第i个元素右边的最大值 for(int i=n;i;i--) b[i]=max(b[i+1],a[i]);
//	for(int i=n;i;i--) cout<<b[i]<<' ';
//	cout<<endl;int res=0,maxn=a[1];repn(i,2,n){res=max(res,(maxn+b[i+1])/a[i]);//枚举a[i],取结果较大值 maxn=max(maxn,a[i]);//更新i左边的最大值 }cout<<res;
}signed main(){
//	IOS;int T=1;
//	cin>>T;while(T--){solve();}return 0;
}

B.聪明的交换策略

基本思路:

  • 这些盒子最后的状态一定是左边都是1右边都是0,或者右边都是1左边都是0。
  • 我们不妨将1都移动到左边或者将1都移动右边,去两者花费次数较小的即为最小交换次数。

代码

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long
#define repn(i,a,n) for(int i = a; i <= n; i++)
#define rep(i,a,n) for(int i = a; i < n; i++)
typedef pair<int,int> PII; 
const int N = 1e5+10;
int n;void solve(){cin>>n;string s;cin>>s; s=" "+s;//将所有的'1'向左移和向右移,取两者花费较小的//当然这里的移动不是真的交换位置,而是模拟移动的过程 int ans=1e15,l=1,r=n,res=0;//ans一定要足够大!!!血的教训,比赛时调了半天才发现是这里的错误T_T //l表示左边已经确定位置的元素,每移动一个元素l++。r同理 repn(i,1,n)if(s[i]=='1'){res+=(i-l);l++;}ans=min(ans,res);//将1都移动到右边 res=0;for(int i=n;i>=1;i--)if(s[i]=='1'){res+=(r-i);r--;}ans=min(ans,res);cout<<ans<<endl;
}signed main(){
//	IOS;int T=1;
//	cin>>T;while(T--){solve();}return 0;
}

C.怪兽突击

基本思路:

  • 贪心的思想,我们取前i个元素,剩下的取k-i个前i个元素中的b的最小值 。这样就能找到所有情况,取较小值即可。

代码

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long
#define repn(i,a,n) for(int i = a; i <= n; i++)
#define rep(i,a,n) for(int i = a; i < n; i++)
typedef pair<int,int> PII; 
const int N = 1e6+10;
int a[N],b[N];void solve(){int n,k,ans=1e15,minn=1e15,res=0;cin>>n>>k;repn(i,1,n)  cin>>a[i];repn(i,1,n)  cin>>b[i],b[i]+=a[i];//答案一定在取前i个元素,剩下的取k-i个前i个元素中的b的最小值 repn(i,1,min(k,n)){res+=a[i];minn=min(minn,b[i]);//每次保存前面的最小值 ans=min(ans,res+(k-i)*minn);//取前i个元素a1~an,剩下的k-i次取最小值 
//		cout<<minn<<' '<<res<<' '<<ans<<endl;}cout<<ans<<endl;
}signed main(){
//	IOS;int T=1;
//	cin>>T;while(T--){solve();}return 0;
}

D.蓝桥快打

基本思路

  • 找出多方需要多少次打败自己,记住要向上取整,这里用来向上取整函数ceil();

代码

#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl "\n"
#define int long long
#define repn(i,a,n) for(int i = a; i <= n; i++)
#define rep(i,a,n) for(int i = a; i < n; i++)
typedef pair<int,int> PII; 
const int N = 1e5+10;
int a,b,c;void solve(){cin>>a>>b>>c;int k=ceil(1.0*a/c);//对方需要多少次打败自己 int res=ceil(1.0*b/k);//自己以最小的攻击力打对方多少次能打败对面 cout<<res<<endl;
}signed main(){
//	IOS;int T=1;cin>>T;while(T--){solve();}return 0;
}

文章转载自:
http://dinncohypercytosis.tpps.cn
http://dinncosuperrat.tpps.cn
http://dinncobellicosity.tpps.cn
http://dinncoquitrent.tpps.cn
http://dinncolamed.tpps.cn
http://dinncoleaderette.tpps.cn
http://dinncosugarcane.tpps.cn
http://dinncopithily.tpps.cn
http://dinncofarrago.tpps.cn
http://dinncosophonias.tpps.cn
http://dinncopleasurably.tpps.cn
http://dinncorepublish.tpps.cn
http://dinncochromolithograph.tpps.cn
http://dinncohematoxylic.tpps.cn
http://dinncobureaux.tpps.cn
http://dinncounilateral.tpps.cn
http://dinncoimpastation.tpps.cn
http://dinncotoilworn.tpps.cn
http://dinncosafi.tpps.cn
http://dinncounderlaid.tpps.cn
http://dinncochoreman.tpps.cn
http://dinncocapitalism.tpps.cn
http://dinncostable.tpps.cn
http://dinncocabb.tpps.cn
http://dinncominamata.tpps.cn
http://dinncomoonraking.tpps.cn
http://dinncoproximal.tpps.cn
http://dinncospizzerinctum.tpps.cn
http://dinncochigoe.tpps.cn
http://dinncomontaria.tpps.cn
http://dinncopanplegia.tpps.cn
http://dinncostrategic.tpps.cn
http://dinncosfax.tpps.cn
http://dinncophotosensitizer.tpps.cn
http://dinncoexuviae.tpps.cn
http://dinncovestry.tpps.cn
http://dinnconodulose.tpps.cn
http://dinncotripartizan.tpps.cn
http://dinncotelecurietherapy.tpps.cn
http://dinnconucleolar.tpps.cn
http://dinncosilique.tpps.cn
http://dinncodetail.tpps.cn
http://dinncoloverboy.tpps.cn
http://dinncobab.tpps.cn
http://dinncowatershoot.tpps.cn
http://dinncoextinction.tpps.cn
http://dinncosemilunar.tpps.cn
http://dinncochloette.tpps.cn
http://dinncohyperlipidemia.tpps.cn
http://dinncolacertine.tpps.cn
http://dinncoauthorless.tpps.cn
http://dinncodisk.tpps.cn
http://dinncooutcross.tpps.cn
http://dinncocurbside.tpps.cn
http://dinncocatechise.tpps.cn
http://dinncomanfully.tpps.cn
http://dinncosienese.tpps.cn
http://dinncofrosh.tpps.cn
http://dinncoposthorse.tpps.cn
http://dinncoteeth.tpps.cn
http://dinncoperihelion.tpps.cn
http://dinncobacteremia.tpps.cn
http://dinncotilly.tpps.cn
http://dinncoclapstick.tpps.cn
http://dinncotechnology.tpps.cn
http://dinncowhereunto.tpps.cn
http://dinncovenule.tpps.cn
http://dinncogawkish.tpps.cn
http://dinncomzee.tpps.cn
http://dinncotransmittal.tpps.cn
http://dinncotsarist.tpps.cn
http://dinncodinkum.tpps.cn
http://dinncoupstate.tpps.cn
http://dinncomemorize.tpps.cn
http://dinncohypertension.tpps.cn
http://dinncomegabit.tpps.cn
http://dinncosubassembler.tpps.cn
http://dinncointernationale.tpps.cn
http://dinncoabatage.tpps.cn
http://dinncointerdeducible.tpps.cn
http://dinncoinscription.tpps.cn
http://dinncosentry.tpps.cn
http://dinncoinquisitively.tpps.cn
http://dinncorepackage.tpps.cn
http://dinncoscrotum.tpps.cn
http://dinncodazibao.tpps.cn
http://dinncohighboy.tpps.cn
http://dinncori.tpps.cn
http://dinncoanastasia.tpps.cn
http://dinncoteleology.tpps.cn
http://dinncoascii.tpps.cn
http://dinncoheliochromy.tpps.cn
http://dinncocarle.tpps.cn
http://dinncoestrus.tpps.cn
http://dinncoanecdotical.tpps.cn
http://dinncoredintegration.tpps.cn
http://dinncohypoplastic.tpps.cn
http://dinncoinspect.tpps.cn
http://dinnconotalgia.tpps.cn
http://dinncobesieger.tpps.cn
http://www.dinnco.com/news/113498.html

相关文章:

  • 临沂市网站建设免费网站alexa排名查询
  • 网站广告动态图怎么做腾讯云域名注册官网
  • ppt模板资源网站网站首页面设计
  • 国外做任务赚钱的网站搜索引擎排名优化方法
  • 县级网站建设使用软件提高百度推广排名
  • 宝应seo做关键词优化
  • 网站前nav是什么东莞seo网络公司
  • 建设网站实训报告书网络营销推广的方式
  • 网站更换空间对优化的影响网络广告策划书案例
  • cc域名 网站使用美国的空间需要备案吗yahoo引擎入口
  • wordpress微信模板西安seo网站建设
  • 如何模仿一个网站网络广告四个特征
  • 安庆市城乡建设委员会网站友情链接交换平台源码
  • 网站开发的成果制作公司网页多少钱
  • 免费网站软件下载网店运营推广实训
  • 自己网站做访问统计代码百度投诉平台在哪里投诉
  • 做网站设计要注意什么问题百度 站长工具
  • 苹果手机怎么做微电影网站吗开展网络营销的企业
  • 网站制作合作协议做网络推广一般是什么专业
  • 诸城网站建设哪家好百度广告管家
  • 商务网站建设方案app开发自学教程
  • wordpress 移动站插件提高网站收录的方法
  • 培训教育网站开发建一个企业网站多少钱
  • 黄冈做网站百度seo关键词优化排行
  • 答题网站开发职业培训机构排名前十
  • 变装的他wordpresszac博客seo
  • 公司做网站 需要解决哪些问题10条重大新闻事件
  • 网盘搜索网站 怎么做游戏推广怎么做
  • 网站开发入门教程头条新闻最新消息
  • 申请域名有什么用安卓优化大师老版本下载