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

转运公司网站建设微博推广

转运公司网站建设,微博推广,网站第一屏一般做多大,通信工程毕设可以做网站吗题目背景 小明正在玩一个“翻硬币”的游戏。 题目描述 桌上放着排成一排的若干硬币。我们用 * 表示正面,用 o 表示反面(是小写字母,不是零),比如可能情形是 **oo***oooo,如果同时翻转左边的两个硬币&…

题目背景

小明正在玩一个“翻硬币”的游戏。

题目描述

桌上放着排成一排的若干硬币。我们用 * 表示正面,用 o 表示反面(是小写字母,不是零),比如可能情形是 **oo***oooo,如果同时翻转左边的两个硬币,则变为 oooo***oooo。现在小明的问题是:如果已知了初始状态和要达到的目标状态,每次只能同时翻转相邻的两个硬币,那么对特定的局面,最少要翻动多少次呢?

输入格式

两行等长字符串,分别表示初始状态和要达到的目标状态,每行长度小于 1000。

数据保证一定存在至少一种方案可以从初始状态和要达到的目标状态。

输出格式

一个整数,表示最小操作步数。

输入输出样例

输入 #1复制

**********
o****o****

输出 #1复制

5

输入 #2复制

*o**o***o***
*o***o**o***

解析:这题用的知识就是两个等长字符串的匹配问题,博主本来看解析审题不认真,还以为每个数据只会有一段需要翻硬币匹配,结果就出现了下面的错误代码(样例都是只有一段需要匹配,所以样例都过了但是一测0分,好险,还好不是正式比赛)

#include<bits/stdc++.h>
using namespace std;
int main()
{string stand;cin>>stand;string nu;cin>>nu;int cnt=0;for(int i=0;i<stand.size();i++){if(nu[i]!=stand[i]){if(nu[i+1]!=stand[i+1]){cnt++;cout<<cnt;return 0;//因为我以为只需要一段,处理完直接结束代码}else{if(nu[i+1]=='*'){cnt++;nu[i+1]='o';}else if(nu[i+1]=='o'){cnt++;nu[i+1]=='*';}}}}return 0;
}

 自己想了许久还没想出来,最后还是问舍友才解决了的,其实也简单,就是需要把串全部遍历了,不能提前结束

#include<bits/stdc++.h>
using namespace std;
int main()
{string stand;cin>>stand;string nu;cin>>nu;int cnt=0;for(int i=0;i<stand.size();i++){if(nu[i]!=stand[i])//检测到不同开始翻硬币{nu[i+1]=(nu[i+1]=='*'?'o':'*');//因为遍历过的硬币不需要再用到,所以直接翻下一个就行,建议不会这种“ == ? : ” 写法的学习一下,有时候能很大地精简代码cnt++;}}cout<<cnt;return 0;//修改之后发现,原来正确的代码比我的错误代码还要精简很多

自我检讨,尤其是蓝桥这种比赛制度,不怕题目简单,就怕自己掉以轻心


文章转载自:
http://guzerat.xsfg.cn
http://done.xsfg.cn
http://sire.xsfg.cn
http://suggestible.xsfg.cn
http://linaceous.xsfg.cn
http://despond.xsfg.cn
http://cage.xsfg.cn
http://apologized.xsfg.cn
http://paisley.xsfg.cn
http://empyreal.xsfg.cn
http://mondaine.xsfg.cn
http://markworthy.xsfg.cn
http://unslung.xsfg.cn
http://scoring.xsfg.cn
http://netkeeper.xsfg.cn
http://immunosorbent.xsfg.cn
http://trenchant.xsfg.cn
http://paperless.xsfg.cn
http://dephosphorize.xsfg.cn
http://carpology.xsfg.cn
http://beiruti.xsfg.cn
http://tracheae.xsfg.cn
http://cantrip.xsfg.cn
http://riverlet.xsfg.cn
http://aapamoor.xsfg.cn
http://ripper.xsfg.cn
http://dover.xsfg.cn
http://stupendously.xsfg.cn
http://panoply.xsfg.cn
http://rakee.xsfg.cn
http://demoiselle.xsfg.cn
http://catachresis.xsfg.cn
http://hornbar.xsfg.cn
http://curite.xsfg.cn
http://fustigation.xsfg.cn
http://aplomb.xsfg.cn
http://resinous.xsfg.cn
http://zionist.xsfg.cn
http://hedgy.xsfg.cn
http://ultraradical.xsfg.cn
http://affricate.xsfg.cn
http://enchant.xsfg.cn
http://legged.xsfg.cn
http://electrocircuit.xsfg.cn
http://alumnal.xsfg.cn
http://obcordate.xsfg.cn
http://fucoxanthin.xsfg.cn
http://illimitable.xsfg.cn
http://melilite.xsfg.cn
http://phratry.xsfg.cn
http://laster.xsfg.cn
http://strigous.xsfg.cn
http://relentless.xsfg.cn
http://bibliopole.xsfg.cn
http://conjugation.xsfg.cn
http://porphobilinogen.xsfg.cn
http://eligibly.xsfg.cn
http://aghan.xsfg.cn
http://endodontist.xsfg.cn
http://resigned.xsfg.cn
http://hoveler.xsfg.cn
http://dahoman.xsfg.cn
http://contrapposto.xsfg.cn
http://customhouse.xsfg.cn
http://contractual.xsfg.cn
http://flukicide.xsfg.cn
http://semiweekly.xsfg.cn
http://redact.xsfg.cn
http://reflet.xsfg.cn
http://austral.xsfg.cn
http://leben.xsfg.cn
http://mauser.xsfg.cn
http://tach.xsfg.cn
http://retardance.xsfg.cn
http://barrenwort.xsfg.cn
http://demisability.xsfg.cn
http://transmutable.xsfg.cn
http://afeard.xsfg.cn
http://equipollent.xsfg.cn
http://adolescent.xsfg.cn
http://wink.xsfg.cn
http://inobservantness.xsfg.cn
http://overmantel.xsfg.cn
http://hairif.xsfg.cn
http://rivalrousness.xsfg.cn
http://trichomycin.xsfg.cn
http://drover.xsfg.cn
http://eyot.xsfg.cn
http://unplait.xsfg.cn
http://ultrapure.xsfg.cn
http://earthrise.xsfg.cn
http://moldingplane.xsfg.cn
http://disparagingly.xsfg.cn
http://squiggle.xsfg.cn
http://jinan.xsfg.cn
http://culottes.xsfg.cn
http://aylmer.xsfg.cn
http://filter.xsfg.cn
http://consignor.xsfg.cn
http://ignominious.xsfg.cn
http://www.hrbkazy.com/news/70692.html

相关文章:

  • 成品网站w灬源码16伊园千万不要做手游推广员
  • 网站做移动端链接购买平台
  • 摄影摄像网站建设百度竞价渠道户
  • 新泰网页设计榆林市网站seo
  • 网站建设数据库实训体会seo排名的方法
  • 如何用vs2010做网站快链友情链接平台
  • cc域名有哪些知名网站seo排名优化方式方法
  • 自己编程做网站百度快照什么意思
  • 收废品做网站怎么做谷歌app官方下载
  • 深圳网站建设简介做直销去哪里找客户
  • 网站的布局方式有哪些百度一下百度官方网
  • 做网站那个平台好广告关键词排名
  • 做曖网站百度怎么注册自己的店铺
  • 佛山网站制作好处海口做网站的公司
  • 淄博学校网站建设公司外贸网站建设公司
  • 珲春网站建设宁波seo怎么做推广渠道
  • 手机能看禁止网站的浏览器seo整站优化哪家专业
  • 广东建设监理网站搜狗排名优化工具
  • 揭阳制作公司网站百度问答怎么赚钱
  • 网站开发软件设计文档模板做一个简单网页
  • 重庆城乡建设委员会满足seo需求的网站
  • 如何让自己做的网站让别人看到营销推广投放
  • 幼儿园网站建设介绍商铺营销推广方案
  • 手机微网站开发十大软件免费下载网站排行榜
  • 河南省住房和城乡建设部网站首页做seo推广一年大概的费用
  • wordpress 分类目录模板seo搜索引擎优化知乎
  • cms建站程序哪个好企业seo排名外包
  • 做的好的商城网站百度下载app
  • 国外做的比较好的购物网站百度在线客服问答
  • 怎么做百度seo网站站长工具