{"id":218,"date":"2021-08-03T10:48:56","date_gmt":"2021-08-03T02:48:56","guid":{"rendered":"http:\/\/blog.nonot.cn\/?p=218"},"modified":"2021-08-03T10:48:56","modified_gmt":"2021-08-03T02:48:56","slug":"%e4%ba%8c%e5%88%86%e6%b3%95-%e5%9c%a8%e4%b8%80%e4%b8%aa%e5%b7%b2%e7%bb%8f%e6%8e%92%e5%a5%bd%e9%a1%ba%e5%ba%8f%e7%9a%84%e6%95%b0%e5%ad%97%e5%ba%8f%e5%88%97%e4%b8%ad%ef%bc%8c%e6%89%be%e5%87%ba%e6%9f%90","status":"publish","type":"post","link":"https:\/\/blog.nonot.cn\/index.php\/2021\/08\/03\/%e4%ba%8c%e5%88%86%e6%b3%95-%e5%9c%a8%e4%b8%80%e4%b8%aa%e5%b7%b2%e7%bb%8f%e6%8e%92%e5%a5%bd%e9%a1%ba%e5%ba%8f%e7%9a%84%e6%95%b0%e5%ad%97%e5%ba%8f%e5%88%97%e4%b8%ad%ef%bc%8c%e6%89%be%e5%87%ba%e6%9f%90\/","title":{"rendered":"\u4e8c\u5206\u6cd5-\u5728\u4e00\u4e2a\u5df2\u7ecf\u6392\u597d\u987a\u5e8f\u7684\u6570\u5b57\u5e8f\u5217\u4e2d\uff0c\u627e\u51fa\u67d0\u4e2a\u5df2\u77e5\u6570\u5b57\u7684\u4f4d\u7f6e"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Js <strong>\u7248\u672c\u7684\u4e8c\u5206\u6cd5\u7b97\u6cd5\u5b9e\u73b0<\/strong> <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;script><br>var a=new Array(3,6,8,10,12,15,16,18,21,25,30);<br>\/\/var a=[&#8220;\u6797\u5927\u5934&#8221;,&#8221;\u738b\u5927\u5934&#8221;,&#8221;\u9648\u5927\u5934&#8221;,&#8221;\u5f20\u5927\u5934&#8221;,&#8221;\u674e\u5927\u5934&#8221;,&#8221;\u90d1\u5927\u5934&#8221;,&#8221;\u9ec4\u5927\u5934&#8221;]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">function seach(n){<br>&nbsp;var low=0,mid,high=a.length-1;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;while( low &lt;= high ){<br>&nbsp;&nbsp;mid = Math.floor((low + high) \/ 2);<br>&nbsp;&nbsp;if (a[mid]==n) return mid;<br>&nbsp;&nbsp;if (a[mid]&lt;n) low=mid+1;<br>&nbsp;&nbsp;else high=mid-1;<br>&nbsp;}<br>&nbsp;return -1;<br>}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">alert(seach(15));<br>&lt;\/script&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>java\u7248\u672c\u7684\u4e8c\u5206\u6cd5\u7b97\u6cd5\u5b9e\u73b0<\/strong><br><br><br>\/**<br>\u6587\u4ef6\u540d\uff1aErFenFa.java<br>\u63cf\u8ff0\uff1a\u5728\u4e00\u4e2a\u5df2\u7ecf\u6392\u597d\u987a\u5e8f\u7684\u6570\u5b57\u5e8f\u5217\u4e2d\uff0c\u627e\u51fa\u67d0\u4e2a\u5df2\u77e5\u6570\u5b57\u7684\u4f4d\u7f6e<br>**\/<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">class ErFenFa<br>{<br>&nbsp;int[] iArray={1,5,9,14,27,39,41,50,62,222,345,612,981,1207,8721}; \/\/\u5728\u6b64\u6570\u5b57\u5e8f\u5217\u4e2d\u5bfb\u627e<br>&nbsp;int iSeek=345;&nbsp;&nbsp; \/\/\u5bfb\u627e345\u7684\u4f4d\u7f6e<br>&nbsp;int iCount=0;&nbsp;&nbsp; \/\/\u6bd4\u8f83\u7684\u6b21\u6570&nbsp;<br>&nbsp;&nbsp;<br>&nbsp;public int xunhuan()<br>&nbsp;\/\/\u666e\u901a\u7684\u5faa\u73af\u6cd5\uff0c\u6700\u5c11\u9700\u8981\u6bd4\u8f83\u4e00\u6b21\uff0c\u6bd4\u5982\u67e5\u627e1\uff0c\u6700\u591a\u9700\u8981\u6bd4\u8f8315\u6b21\uff0c\u6bd4\u59828721<br>&nbsp;{<br>&nbsp;&nbsp;for(int i=0;i&lt;iArray.length;i++)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;iCount++;<br>&nbsp;&nbsp;&nbsp;if (iSeek==iArray[i])<br>&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;return iCount;<br>&nbsp;}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;public int erfen()<br>&nbsp;\/\/\u4e8c\u5206\u6cd5\u67e5\u627e<br>&nbsp;{<br>&nbsp;&nbsp;int iIndex=0;&nbsp;&nbsp; \/\/\u76f8\u5f53\u4e8e\u6307\u9488\u7684\u4e1c\u897f<br>&nbsp;&nbsp;int iStart=0;&nbsp;&nbsp; \/\/<br>&nbsp;&nbsp;int iEnd=iArray.length-1;<br>&nbsp;&nbsp;while(true)<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;iCount++;<br>&nbsp;&nbsp;&nbsp;iIndex = (iStart+iEnd)\/2;<br>&nbsp;&nbsp;&nbsp;if(iArray[iIndex]&lt;iSeek)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;iStart = iIndex;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;else if(iArray[iIndex]&gt;iSeek)<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;iEnd = iIndex;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;else<br>&nbsp;&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;break;<br>&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;}<br>&nbsp;&nbsp;return iCount;&nbsp;<br>&nbsp;}<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;public static void main(String[] args)<br>&nbsp;{&nbsp;&nbsp;<br>&nbsp;&nbsp;ErFenFa eff=new ErFenFa();<br>&nbsp;&nbsp;ErFenFa eff1=new ErFenFa();&nbsp;&nbsp;<br>&nbsp;&nbsp;System.out.println(&#8220;\u666e\u901a\u7684\u5faa\u73af\u67e5\u627e\uff0c\u9700\u8981\u6bd4\u8f83\u7684\u6b21\u6570\uff1a&#8221;+eff.xunhuan());<br>&nbsp;&nbsp;System.out.println(&#8220;\u4e8c\u5206\u6cd5\u67e5\u627e\uff0c\u9700\u8981\u6bd4\u8f83\u7684\u6b21\u6570\uff1a&#8221;+eff1.erfen());<br>&nbsp;}<br>}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Js \u7248\u672c\u7684\u4e8c\u5206\u6cd5\u7b97\u6cd5\u5b9e\u73b0 &lt;script>var a&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-218","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/comments?post=218"}],"version-history":[{"count":0,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/posts\/218\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/media?parent=218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/categories?post=218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nonot.cn\/index.php\/wp-json\/wp\/v2\/tags?post=218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}