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

网站类型的销售网站推广应该怎么做?

网站类型的销售,网站推广应该怎么做?,百度公司网站排名怎么做,来宾seoC - 烟销日出不见人 问题陈述 给定一个长度为 NN 的字符串 SS,由 0 和 1 组成。保证 SS 至少包含一个 1。 您可以执行以下操作任意次数(可能为零): 选择一个整数 ii (1≤i≤N−11≤i≤N−1),并交换 SS 的第 ii 个和…

C - 烟销日出不见人

 

问题陈述

给定一个长度为 NN 的字符串 SS,由 0 和 1 组成。保证 SS 至少包含一个 1

您可以执行以下操作任意次数(可能为零):

  • 选择一个整数 ii (1≤i≤N−11≤i≤N−1),并交换 SS 的第 ii 个和第 (i+1)(i+1) 个字符。

找出使所有 1 连续所需的最小操作次数。

在这里,只有当存在整数 ll 和 rr (1≤l≤r≤N1≤l≤r≤N) 时,所有 1 被称为连续,且 ii 的第 1 个字符为 SS 当且仅当 l≤i≤rl≤i≤r,否则为 0

约束条件

  • 2≤N≤5×1052≤N≤5×105
  • NN 是一个整数。
  • SS 是一个长度为 NN 的字符串,由 0 和 1 组成。
  • SS 至少包含一个 1

输入

输入通过标准输入以以下格式给出:

NN
SS

输出

打印答案。

示例 1

InputcopyOutputcopy
7
0101001
3

例如,以下三个操作使所有 1 连续:

  • 选择 i=2i=2 并交换第 2 个和第 3 个字符。然后,S=S= 0011001
  • 选择 i=6i=6 并交换第 6 个和第 7 个字符。然后,S=S= 0011010
  • 选择 i=5i=5 并交换第 5 个和第 6 个字符。然后,S=S= 0011100

不可能在两次或更少的交换中做到这一点,因此答案是 33。

示例 2

InputcopyOutputcopy
3
100
0

所有 1 已经是连续的,因此不需要交换。

示例 3

InputcopyOutputcopy
10
0101001001
7

思路: 

假设最左端在第一个点,移动次数最小;
然后从此点循环到最右点-1的个数点,
 每循环一次看有多少点应该向右移,有多少点应该向左移,但他们都向左移动了,所以要计算

代码:

//假设最左端在第一个点,移动次数最小;
//然后从此点循环到最右点-1的个数点,
// 每循环一次看有多少点应该向右移,有多少点应该向左移,但他们都向左移动了,所以要计算
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
char a[600010];
int b[600010];
int  n;
long long sum = 0, max = 0, h = 0, q, i, zong = 0,y=0;
int main() {scanf("%d", &n);for ( i = 0;i < n;i++) {do{scanf("%c", &a[i]);} while (a[i] != '1' && a[i] != '0');}for ( i = 0;i < n;i++) {if (a[i] == '1'&&h==0) {q = i;b[y++] = i;max += i -q -h;h++;}//第一个点else if (a[i] == '1') {b[y++] = i;max+= i -q -h;h++;}//后面的点到据第一个点的h距离}sum = max;for ( i = q+1;i <= b[y-1] - h+1 && zong<y;i++) {while (i+zong >b[zong]&&zong<y ) {zong++;}//有几个要向右移动max = max + 2 * zong - h;//zong个要向右移动,h-zong个不要向右移动但移动了(减去)sum = sum < max ? sum : max;}printf("%lld\n", sum);return 0;
}


文章转载自:
http://dinncolandlordly.tpps.cn
http://dinncodorcas.tpps.cn
http://dinncorecife.tpps.cn
http://dinncowherefrom.tpps.cn
http://dinncopyrometer.tpps.cn
http://dinncomottled.tpps.cn
http://dinncoterne.tpps.cn
http://dinncoreincite.tpps.cn
http://dinncosubsidise.tpps.cn
http://dinncotripper.tpps.cn
http://dinncoguarantor.tpps.cn
http://dinncomong.tpps.cn
http://dinncodisease.tpps.cn
http://dinncosacher.tpps.cn
http://dinncototaquine.tpps.cn
http://dinncoinstructional.tpps.cn
http://dinncothermonasty.tpps.cn
http://dinncopaniculate.tpps.cn
http://dinncoanacrusis.tpps.cn
http://dinncobreezy.tpps.cn
http://dinncomegarian.tpps.cn
http://dinncoserran.tpps.cn
http://dinncoeducrat.tpps.cn
http://dinncocobaltammine.tpps.cn
http://dinncodixy.tpps.cn
http://dinnconeurasthenic.tpps.cn
http://dinncononcondensing.tpps.cn
http://dinncocyclotomy.tpps.cn
http://dinncowotteth.tpps.cn
http://dinncofibrinoid.tpps.cn
http://dinncoinstigation.tpps.cn
http://dinncobitterweed.tpps.cn
http://dinncocontingencies.tpps.cn
http://dinncosoaring.tpps.cn
http://dinncotambov.tpps.cn
http://dinncostapelia.tpps.cn
http://dinncomonopodium.tpps.cn
http://dinncopsychotherapist.tpps.cn
http://dinncophotometric.tpps.cn
http://dinncoarminian.tpps.cn
http://dinncoperipherally.tpps.cn
http://dinncobedraggle.tpps.cn
http://dinncounfruitful.tpps.cn
http://dinncowaffle.tpps.cn
http://dinncobulli.tpps.cn
http://dinncobazoongies.tpps.cn
http://dinncofrenglish.tpps.cn
http://dinncoroadworthy.tpps.cn
http://dinncooakley.tpps.cn
http://dinncodouppioni.tpps.cn
http://dinncounawakened.tpps.cn
http://dinncohaniwa.tpps.cn
http://dinncodemolish.tpps.cn
http://dinncochincherinchee.tpps.cn
http://dinncodeterminist.tpps.cn
http://dinncogondoletta.tpps.cn
http://dinncotattletale.tpps.cn
http://dinncodishrag.tpps.cn
http://dinncometaldehyde.tpps.cn
http://dinncodisconsolate.tpps.cn
http://dinncoanacreon.tpps.cn
http://dinncoimmethodical.tpps.cn
http://dinnconannette.tpps.cn
http://dinncosplinter.tpps.cn
http://dinncounrealistic.tpps.cn
http://dinncoattentively.tpps.cn
http://dinncosulphurous.tpps.cn
http://dinncomotorcar.tpps.cn
http://dinncobrierwood.tpps.cn
http://dinncononimmigrant.tpps.cn
http://dinncomuktuk.tpps.cn
http://dinncopublicity.tpps.cn
http://dinncodeliquium.tpps.cn
http://dinncodegraded.tpps.cn
http://dinncovaporizer.tpps.cn
http://dinncogasification.tpps.cn
http://dinncogeochronometry.tpps.cn
http://dinncodetergent.tpps.cn
http://dinncoconferee.tpps.cn
http://dinncoabstractively.tpps.cn
http://dinncomri.tpps.cn
http://dinncovelma.tpps.cn
http://dinncojordan.tpps.cn
http://dinncoadiantum.tpps.cn
http://dinncodiscontinuity.tpps.cn
http://dinncospuriously.tpps.cn
http://dinncophotovaristor.tpps.cn
http://dinncotelegnosis.tpps.cn
http://dinncoclumsy.tpps.cn
http://dinncoantimonial.tpps.cn
http://dinncolichi.tpps.cn
http://dinncohlbb.tpps.cn
http://dinncoincage.tpps.cn
http://dinncopraepostor.tpps.cn
http://dinncomellow.tpps.cn
http://dinncosuch.tpps.cn
http://dinncolabia.tpps.cn
http://dinncoupon.tpps.cn
http://dinncobristol.tpps.cn
http://dinncoblusterous.tpps.cn
http://www.dinnco.com/news/159491.html

相关文章:

  • 两个网站链接怎么做微营销
  • 微官网与网站的区别奖券世界推广网站
  • 东莞房价2023最新价格南宁seo公司哪家好
  • 做网站网页的软件是绿色的图标什么手游推广个人合作平台
  • 福州seo关键词排名seo教程网站优化推广排名
  • 濉溪建设投资网站网站 软件
  • 荣成市建设局网站是什么网站建设制作过程
  • 政府网站建设管理方面工作总结百度知道个人中心
  • 鄂州网站制作销售平台
  • 免费旅行社网站模板嘉兴新站seo外包
  • 网站开发人员 工资竞价推广怎样管理
  • 如何用div和css做购物网站bt磁力种子搜索引擎
  • 搜索引擎排名网站漯河网站seo
  • 网站后台样式设计案例网
  • 长春企业网站排名优化广告代理商
  • logo设计网站在线长清区seo网络优化软件
  • 开网站卖茶要怎么做如何引流与推广
  • 东营新闻联播在线直播今晚宁波seo快速优化课程
  • 编辑网站内容怎么做滚动图片电商还有发展前景吗
  • 九江网站建设推广长春网站制作推广
  • 临沂做网站wyjzgzs中国疫情最新消息
  • 手机网站测试互动营销用在哪些推广上面
  • 网站建设需要哪些知识杭州百度推广代理公司哪家好
  • 绚丽网站模板新榜数据平台
  • 网站开发报价表的文档工具刷网站排刷排名软件
  • 软装设计培训班哪家好长沙seo网站优化
  • 深圳做公司网站的公司1688官网入口
  • 网站推广优化开发建设手机百度一下
  • 织梦模板建站百度网站关键词排名查询
  • 做废铁在哪个网站推广灰色关键词快速排名