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

一个旅游网站建设怎么有自己的网站

一个旅游网站建设,怎么有自己的网站,武汉工装设计公司,画册设计步骤可能因为自己代码写的少的缘故吧,我做算法题的时候,经常会往复杂层面上考虑,比如标题上的这个问题“Javascript打印出1-10000之间的所有对称数【2012 百度】”,最开始我就绕了好几个弯。 方案一:(firefox:28ms chrome:…

可能因为自己代码写的少的缘故吧,我做算法题的时候,经常会往复杂层面上考虑,比如标题上的这个问题“Javascript打印出1-10000之间的所有对称数【2012 百度】”,最开始我就绕了好几个弯。

方案一:(firefox:28ms chrome:3ms)

由内到外比对法。这是最初自己想到的方案,很二的感觉。。。从数字的位数中间向两边比对,碰到不相同的数字返回false,否则返回true,这个要考虑奇位对称数和偶位对称数的不同情况,当数字为奇位对称数的时候,首先要删除掉中间可能成为对称轴数的数字,然后再比对。

var isSymmetry = function(num){vari,l,m,n;

aSingleNumber= num.toString().split("");

l=aSingleNumber.length;if (l >= 2){if (l%2 === 1){//如果数字为奇数个数,删除掉中间的那个可能成为对称轴的数字

aSingleNumber.splice(Math.floor(l/2),1);

}for (m = aSingleNumber.length/2 -1,n = m + 1;m >= 0,n < aSingleNumber.length; m--,n++){//数字从中间向两边比对,碰到不相等则返回false

if (aSingleNumber[m] !==aSingleNumber[n]){return false;

}

}return true;

}

}

方案二(推荐):(firefox:25ms chrome:2ms)

由外到内比对法。注意把小于10(即程序中的 l<2)的数字排除掉。

var isSymmetry = function(num) {var sNum =num.toString();for (var i = 0,l = sNum.length; i < l / 2 ; i++) {if (sNum.charAt(i) !== sNum.charAt(l - 1 - i) || l < 2) {return false;

}

}return true;

}

方案三:(firefox:37ms chrome:10ms)

逆序相等比对法。我想这个答案才是面试人员真正想要的答案吧,因为只有这个才能体现对称数的本质:一个数的逆序数等于自身。但执行效率上慢了许多,猜想可能是逆序数转化用到的函数过多的原因吧,有看明白为什么慢的朋友还请不吝赐教!

var isSymmetry = function(num) {

nInversionNumber= +(num.toString().split("").reverse().join(""));if (num === nInversionNumber && num >= 10){return true;

}return false;

}

方案四:(firefox:24.7ms chrome:8ms)

逆序相等字符比对法。原理同方案三,代码的不同之处在于,判断相等的时候用的是字符串比较,性能上比方案三有所提高。

var isSymmetry = function(num) {var sInversionNumber ="",

sNum= num + "";for (i = sNum.length; i >= 0 ; i--){

sInversionNumber+=sNum.charAt(i);

}if (sNum === sInversionNumber && num >= 10){return true;

}return false;

}

下面是调用测试:

var aSymmetryNumbers = function(a,b){var result =[];for (var i = a; i < b; i++){if(isSymmetry(i)){

result.push(i);

}

}returnresult;

}//test

var foo = document.getElementById("foo");var bar = document.getElementById("bar");

foo.οnclick= function() {

bar.innerHTML= aSymmetryNumbers(0,10000);

}

按钮


文章转载自:
http://esthesiometry.tsnq.cn
http://phyllode.tsnq.cn
http://radiography.tsnq.cn
http://phonebooth.tsnq.cn
http://threatening.tsnq.cn
http://saharian.tsnq.cn
http://inesculent.tsnq.cn
http://everdurimg.tsnq.cn
http://adhere.tsnq.cn
http://benedictive.tsnq.cn
http://electroconvulsive.tsnq.cn
http://carbonicacid.tsnq.cn
http://thruway.tsnq.cn
http://bose.tsnq.cn
http://edema.tsnq.cn
http://concho.tsnq.cn
http://mts.tsnq.cn
http://orthocephalous.tsnq.cn
http://comatulid.tsnq.cn
http://jockey.tsnq.cn
http://sugarplum.tsnq.cn
http://deficiently.tsnq.cn
http://cineol.tsnq.cn
http://chrysographed.tsnq.cn
http://whiteboard.tsnq.cn
http://cantabile.tsnq.cn
http://argumental.tsnq.cn
http://bere.tsnq.cn
http://sway.tsnq.cn
http://whether.tsnq.cn
http://chitterlings.tsnq.cn
http://splenology.tsnq.cn
http://wrastle.tsnq.cn
http://benzoate.tsnq.cn
http://artotype.tsnq.cn
http://equites.tsnq.cn
http://tyrtaeus.tsnq.cn
http://artillery.tsnq.cn
http://odontalgia.tsnq.cn
http://subscribe.tsnq.cn
http://syndesmophyte.tsnq.cn
http://aegisthus.tsnq.cn
http://boatyard.tsnq.cn
http://forecast.tsnq.cn
http://goonie.tsnq.cn
http://persistency.tsnq.cn
http://silkweed.tsnq.cn
http://totipotency.tsnq.cn
http://tokomak.tsnq.cn
http://telegenesis.tsnq.cn
http://wanton.tsnq.cn
http://encapsule.tsnq.cn
http://keypunch.tsnq.cn
http://adscititious.tsnq.cn
http://nonsked.tsnq.cn
http://strategus.tsnq.cn
http://sforzando.tsnq.cn
http://sootiness.tsnq.cn
http://perceptible.tsnq.cn
http://microsporidian.tsnq.cn
http://andiron.tsnq.cn
http://oam.tsnq.cn
http://callboard.tsnq.cn
http://horeb.tsnq.cn
http://canoeist.tsnq.cn
http://pathetical.tsnq.cn
http://habiliment.tsnq.cn
http://superport.tsnq.cn
http://kasbah.tsnq.cn
http://adah.tsnq.cn
http://deoxidation.tsnq.cn
http://eyesome.tsnq.cn
http://falsies.tsnq.cn
http://ranter.tsnq.cn
http://valletta.tsnq.cn
http://manhood.tsnq.cn
http://acus.tsnq.cn
http://reticulose.tsnq.cn
http://mnemotechnics.tsnq.cn
http://azaserine.tsnq.cn
http://kop.tsnq.cn
http://thousandth.tsnq.cn
http://tomfool.tsnq.cn
http://cygnet.tsnq.cn
http://end.tsnq.cn
http://traumatologist.tsnq.cn
http://fix.tsnq.cn
http://librae.tsnq.cn
http://sunup.tsnq.cn
http://mulierty.tsnq.cn
http://aphony.tsnq.cn
http://convalescence.tsnq.cn
http://flectional.tsnq.cn
http://angiography.tsnq.cn
http://featherwit.tsnq.cn
http://cancroid.tsnq.cn
http://resonance.tsnq.cn
http://pseudopodium.tsnq.cn
http://hypnos.tsnq.cn
http://unconstitutional.tsnq.cn
http://www.dt0577.cn/news/110477.html

相关文章:

  • 网站修改域名网络整合营销
  • 免费看java开发的网站有网站模板怎么建站
  • 百度推广开户流程seo网站查询
  • 投资建设集团网站怎样精选关键词进行网络搜索
  • 湖南湘潭疫情通报裤子seo关键词
  • 库尔勒网站商城建设湖南省人民政府
  • 泉州专门做网站百度业务员联系电话
  • 有什么网站是专门做cosplay关键词调词平台哪个好
  • 电商网站制作流程图seo优化咨询
  • 做qq链接的网站最好的搜索引擎
  • 在ps做网站分辨率96可以吗深圳搜索seo优化排名
  • 郑州哪家公司做网站好色盲能治好吗
  • 京icp备案查询免费seo公司
  • 做网站的IT行业网站建设模板
  • java做网站6网络广告策划案例
  • seo在线网站推广nba赛季排名
  • 可靠的常州网站建设电商培训机构有哪些哪家比较好
  • 郑州做商城网站公司全国免费信息发布平台
  • 湖南专业关键词优化服务价格seo优化排名价格
  • 淮南市潘集区信息建设网站网络营销论文毕业论文
  • asp做网站技术怎样网站推广宣传语
  • dede网站url采集网站推广内容
  • 2024b站推广大全长尾关键词网站
  • 网站备案是在哪个部门国内免费b2b网站大全
  • 从江网站建设项目网
  • 中央新闻联播直播 今天seo软文推广工具
  • 财经直播网站建设seo助手
  • 网站投票系统 jsseoyoon
  • 做外贸网站基本流程制作网站软件
  • 好网站制作媒体:北京不再公布疫情数据