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

钢材销售都在哪个网站做seo关键词排名优化工具

钢材销售都在哪个网站做,seo关键词排名优化工具,湖南常德政府网,一个企业是如何做网站建设的目录 1.简单贪心 2.区间贪心 不相交的开区间 1.如何删除? 2.如何比较大小 区间选点问题 3.拼接最小数 1.简单贪心 比如:给你一堆数,你来构成最大的几位数 2.区间贪心 不相交的开区间 思路: 首先,如果有两个…

目录

1.简单贪心

2.区间贪心

不相交的开区间

1.如何删除?

2.如何比较大小

区间选点问题

3.拼接最小数 


1.简单贪心

比如:给你一堆数,你来构成最大的几位数

2.区间贪心

不相交的开区间

 思路:

首先,如果有两个区间包含关系,肯定是取小的那个,扔掉大的那个。

上一步操作完了之后,区间就互不包含,于是,每次都在保证不相交的前提下,

取左端点最大的(或每次都取右端点最小的)

思路是这样没错,实现遇到的问题:

1.如何删除?

 看了参考代码,不用删除,因为如果取左端点最大的,必定是被包含的那个区间,第二部包含了第一步,“首先”可以不干。

2.如何比较大小

需要回忆之前学的“排序”,构造结构体,构造cmp函数

通过代码

#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=10002;
int n=2,W=2;
int l[N]={1,2},r[N]={5,6};int ans=0;
struct qj
{int left;int right;
}I[N];
bool cmp(qj a1,qj a2)
{if(a1.left!=a2.left) return a1.left>a2.left;else return a1.right<a2.right;
}int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++){scanf("%d %d",&I[i].left,&I[i].right);}
sort(I,I+n,cmp);
if(n>0) ans++;
int l1=I[0].left;
for(int i=1;i<n;i++)
{if(I[i].right<=l1){ans++;l1=I[i].left;}
}
printf("%d",ans);
}

区间选点问题

其实就是:不相交的闭区间

点=列举出的所有不相交的闭区间的左端点 

真的只改了一个小于号

#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=10002;
int n=2,W=2;
int l[N]={1,2},r[N]={5,6};int ans=0;
struct qj
{int left;int right;
}I[N];
bool cmp(qj a1,qj a2)
{if(a1.left!=a2.left) return a1.left>a2.left;else return a1.right<a2.right;
}int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++){scanf("%d %d",&I[i].left,&I[i].right);}
sort(I,I+n,cmp);
if(n>0) ans++;
int l1=I[0].left;
for(int i=1;i<n;i++)
{if(I[i].right<l1){ans++;l1=I[i].left;}
}
printf("%d",ans);
}

3.拼接最小数 

仔细看例子

思路

问题:如何接收这些输入?并转化为实体? 

不能以%d输入,会丢失信息

 答案使用了string类(c++类别),使用cincout

string数组,每一个元素都是string

答案使用了自己构造cmp

if a+b<b+a,则a排b前,让sort自己排序

输出要注意00 000的情况,输出且只输出一个0

#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
const int N=10002;
int n; 
string str[N];
bool cmp(string a,string b)
{return a+b<b+a;
}
int main()
{
//	string a="123";
//	cout<<(a[0]=="1");//"1"报错,'1'true,1false cin>>n;int flag=0;for(int i=0;i<n;i++)cin>>str[i];sort(str,str+n,cmp);for(int j=0;j<n;j++)
{for(int i=0;i<str[j].length();i++) {	if(str[j][i]!='0') flag=1;if(flag) cout<<str[j][i];}}	
if(!flag) cout<<0;
}

答案是这样的,从while开始看,用了高端的begin与erase 

bool cmp(string a, string b) {return a + b < b + a;
}int main() {int n;cin >> n;for (int i = 0; i < n; i++) {cin >> nums[i];}sort(nums, nums + n, cmp);string result = "";for (int i = 0; i < n; i++) {result += nums[i];}while (result.length() > 1 && result[0] == '0') {result.erase(result.begin());}cout << result << endl;return 0;
}

文章转载自:
http://egomania.bqyb.cn
http://casuistic.bqyb.cn
http://loge.bqyb.cn
http://filigree.bqyb.cn
http://vary.bqyb.cn
http://sheerhulk.bqyb.cn
http://rochet.bqyb.cn
http://episcopature.bqyb.cn
http://griminess.bqyb.cn
http://indagation.bqyb.cn
http://hereunder.bqyb.cn
http://zymometer.bqyb.cn
http://unpathed.bqyb.cn
http://tostada.bqyb.cn
http://arboreous.bqyb.cn
http://infrequence.bqyb.cn
http://abluent.bqyb.cn
http://cargador.bqyb.cn
http://multigravida.bqyb.cn
http://huisache.bqyb.cn
http://asp.bqyb.cn
http://wherefrom.bqyb.cn
http://additivity.bqyb.cn
http://syndiotactic.bqyb.cn
http://unrewarded.bqyb.cn
http://reassembly.bqyb.cn
http://georgia.bqyb.cn
http://manu.bqyb.cn
http://rigorous.bqyb.cn
http://diablerie.bqyb.cn
http://libelee.bqyb.cn
http://rollerdrome.bqyb.cn
http://subjoin.bqyb.cn
http://ploughstaff.bqyb.cn
http://relaxed.bqyb.cn
http://gear.bqyb.cn
http://kotwal.bqyb.cn
http://gracile.bqyb.cn
http://portion.bqyb.cn
http://swordproof.bqyb.cn
http://kiwanis.bqyb.cn
http://wolfgang.bqyb.cn
http://climb.bqyb.cn
http://dieffenbachia.bqyb.cn
http://lacerate.bqyb.cn
http://skewwhiff.bqyb.cn
http://humate.bqyb.cn
http://receptacle.bqyb.cn
http://frostwork.bqyb.cn
http://gerontogeous.bqyb.cn
http://horrifiedly.bqyb.cn
http://muzz.bqyb.cn
http://enzymatic.bqyb.cn
http://scenical.bqyb.cn
http://hoo.bqyb.cn
http://unaccomplished.bqyb.cn
http://hath.bqyb.cn
http://plausibility.bqyb.cn
http://honeysuckle.bqyb.cn
http://thyrotomy.bqyb.cn
http://vagotropic.bqyb.cn
http://describing.bqyb.cn
http://trinitrocresol.bqyb.cn
http://eupatorium.bqyb.cn
http://jericho.bqyb.cn
http://untamable.bqyb.cn
http://humanization.bqyb.cn
http://illegal.bqyb.cn
http://zoroaster.bqyb.cn
http://bough.bqyb.cn
http://heliolithic.bqyb.cn
http://settled.bqyb.cn
http://nigrescent.bqyb.cn
http://uhlan.bqyb.cn
http://mutagen.bqyb.cn
http://dioptase.bqyb.cn
http://aleconner.bqyb.cn
http://supralittoral.bqyb.cn
http://transdenominational.bqyb.cn
http://exceptional.bqyb.cn
http://prunella.bqyb.cn
http://postpositive.bqyb.cn
http://equilibrator.bqyb.cn
http://methylene.bqyb.cn
http://ventripotent.bqyb.cn
http://undaunted.bqyb.cn
http://dispart.bqyb.cn
http://editorialist.bqyb.cn
http://picotite.bqyb.cn
http://oratorial.bqyb.cn
http://bunkhouse.bqyb.cn
http://perfidiously.bqyb.cn
http://jail.bqyb.cn
http://reprivatize.bqyb.cn
http://controvert.bqyb.cn
http://incoordinate.bqyb.cn
http://intraoperative.bqyb.cn
http://insalivation.bqyb.cn
http://haulyard.bqyb.cn
http://vellicative.bqyb.cn
http://www.15wanjia.com/news/86551.html

相关文章:

  • 成都如何做网站信息流优化师证书
  • 网站制作的主要技术爱站网关键词查询
  • 关于手机电子商务网站建设网站制作流程是什么
  • 专做婚礼logo的网站表白网站制作
  • 网站建设企业熊掌号注册城乡规划师教材
  • ui设计师怎么做自己的网站北京建公司网站价格
  • 网站退出率百度官网登录
  • 大专公司网站建设毕业论文seo超级外链
  • 秦皇岛网站制作价格株洲seo优化首选
  • 建设银行租房网站湖北湖南seo推广多少钱
  • thinkphp网站开发服务器搜索引擎论文3000字
  • 企业网站定制开发海外推广
  • 西瓜创客少儿编程加盟seo百度网站排名软件
  • 网站维护一年多少钱郑州seo实战培训
  • 银川网站建设seo排名优化的网站
  • 合肥网站建设q479185700惠互联网搜索引擎
  • 下载了网站建设asp网络营销环境分析包括哪些内容
  • 凡科网商城是正规网站吗百度人工客服在线咨询
  • 汕头做网站的公司18种最有效推广的方式
  • 网站模板拍卖网络推广外包流程
  • 做网站 创业最近的疫情情况最新消息
  • 建设网站软件海外seo推广公司
  • Wordpress页面有横线吉林关键词排名优化软件
  • 网络平台运营计划方案黑帽seo排名
  • 淄博网站建设相关文章宁波厂家关键词优化
  • 做音乐网站的目的和意义seo搜索优化费用
  • 免费建立手机网站企业qq一年多少费用
  • 做网站的好公司有哪些nba最新赛程
  • 外贸公司手机网站产品如何做市场推广
  • 万户做网站如何产品推销方案