锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久精品视频导航,午夜免费电影一区在线观看 ,日韩亚洲精品视频http://www.shnenglu.com/flyinghearts/zh-cnSat, 29 Nov 2025 09:06:25 GMTSat, 29 Nov 2025 09:06:25 GMT60SEH寮傚父澶勭悊涓撳埄鍒版湡浜?/title><link>http://www.shnenglu.com/flyinghearts/archive/2014/06/15/207288.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Sun, 15 Jun 2014 02:55:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2014/06/15/207288.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/207288.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2014/06/15/207288.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/207288.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/207288.html</trackback:ping><description><![CDATA[<div>銆銆<br />銆銆Borland鐨勯偅涓伓蹇冪殑SEH寮傚父澶勭悊涓撳埄錛圢o:5,628,016  Filed: June, 15, 1997錛夛紝緇堜簬鍒版湡浜嗐傚笇鏈汫CC/CLANG鑳藉揩鐐瑰畬鎴恮in32鐨凜++寮傚父鐨凷EH瀹炵幇錛屼笅涓鐗堟湰鐨凣CC錛岃兘璁╃敤鎴蜂笉鍐嶇籂緇揝JLJ錛孌warf2鐨勯夋嫨銆?br /><br /></div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/207288.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2014-06-15 10:55 <a href="http://www.shnenglu.com/flyinghearts/archive/2014/06/15/207288.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>闈㈣瘯棰? 鎵懼嚭鏁扮粍涓笁涓彧鍑虹幇涓嬈$殑鏁?/title><link>http://www.shnenglu.com/flyinghearts/archive/2013/03/21/198695.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Thu, 21 Mar 2013 14:00:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2013/03/21/198695.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/198695.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2013/03/21/198695.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/198695.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/198695.html</trackback:ping><description><![CDATA[<p style="text-align:center" align="center"><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";"><br /></span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";"></span></strong></p> <p><strong><span>    </span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">棰樼洰錛氭暟緇勪腑鏈変笁涓暟鍙嚭鐜頒竴嬈★紝鍏跺畠鐨勬暟鎭板ソ鍑虹幇涓ゆ錛屾壘鍑鴻繖涓変釜鏁般?/span></strong></p> <p> </p> <p><span>    </span><span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman";">鍏堣冭檻“鍙湁涓や釜鏁板嚭鐜頒竴嬈?#8221;鐨勬儏鍐碉細(xì)鍙互鎵懼埌涓縐嶆柟娉曪紝灝嗘暟緇勫垝鍒嗕負(fù)涓ら儴鍒嗭紝涓旇榪欎袱涓暟鍒嗗埆鍦ㄤ笉鍚岄儴鍒嗭紝榪欐牱姣忛儴鍒嗘墍鏈夋暟鐨勫紓鎴栧鹼紝鎭板ソ鍒嗗埆絳変簬榪欎袱涓暟銆備竴縐嶇畝鍗曠殑鍒嗘硶灝辨槸錛屽厛璁$畻鍑鴻繖涓や釜鏁扮殑寮傛垨鍊?/span>M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛堢瓑浠蜂簬姹傛暟緇勪腑鎵鏈夋暟鐨勫紓鎴栧鹼級錛屾眰鍑?/span>M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍊肩殑浜岃繘鍒惰〃紺轟腑鐨勬渶浣庝綅</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛堝叾瀹冧綅鐨?/span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">涔熷彲浠ワ紝鍙笉榪囬夯鐑︾偣錛夊湪</span> +k<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶏紝鐒跺悗鏍規(guī)嵁</span> +k<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶆槸鍚︿負(fù)</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽皢鍘熸暟緇勫垎涓轟袱閮ㄥ垎銆?/span></p> <p><span>    </span></p> <p><span>    </span><span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman";">鍥炲埌鍘熼錛屽亣璁捐繖涓変釜涓嶅悓鐨勬暟鏄細(xì)</span>A<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>B<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>C<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽畠浠殑寮傛垨鍊?/span> <strong><span>X = A xor B xor C</span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛?/span>X<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍊煎彲鑳戒負(fù)</span>0<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屼篃鍙兘涓嶄負(fù)</span>0<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傚綋</span>X<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍊間笉涓?/span>0<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鏃訛紙姣斿錛氳繖涓変釜鏁頒負(fù)</span>3<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>5<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>7<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛?/span>X<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍊間負(fù)</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛夛紝寰堥毦鎵懼埌涓縐嶆柟娉曪紝灝嗗師鏉ョ殑鏁扮粍鍒掑垎涓轟袱閮ㄥ垎錛屼嬌寰楄繖涓変釜鏁頒笉閮藉湪鍚屼竴閮ㄥ垎銆傚洜鑰岋紝<strong>瑕佸厛瀵瑰師鏉ョ殑鏁扮粍榪涜涓嬈℃浛鎹細(xì)灝嗘瘡涓暟涓?/strong></span><strong>X</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">榪涜寮傛垨</span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傝繖鏍峰師鏉ョ殑涓変釜鏁板氨鍙樻垚浜嗭細(xì)</span></p> <p>B xor C<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>A xor C<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>A xor B<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傝</span><strong>a = B xor C</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></strong><strong>b = A xor C</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></strong><strong><span>c = A xor B</span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傛柊鐨勫紓鎴栧?/span> x = <strong>a xor b xor c = 0</strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></p> <p> <span>  </span></p> <p><span>    </span><span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman";">鐢變簬</span>A<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>B<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>C<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浜掍笉鐩哥瓑錛屾樉鐒跺畠浠棿鐨勫紓鎴栧?/span><strong>a</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></strong><strong>b</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></strong><strong>c</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">閮戒笉涓?/span></strong><strong>0</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屼笖浜掍笉鐩哥瓑</span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傦紙鑻?/span>a<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">絳変簬</span>b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽垯</span><span> 0 = a xor b = (B xor C) xor (A xor C) = A xor B != 0</span><span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman";">鑷浉鐭涚浘錛?/span></p> <p><span>   </span></p> <p style="text-indent:21.1pt;"><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";color:#993300;">鑻ヤ笁涓暟鐨勫紓鎴栧間負(fù)</span></strong><strong><span style="color:#993300;">0</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"; color:#993300;">錛屼笖鍏朵腑涓涓暟鍦?/span></strong><strong><span style="color:#993300;"> +n</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";color:#993300;">浣嶏紙</span></strong><strong><span style="color:#993300;">n</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";color:#993300;">涓轟換鎰忓鹼級涓婁負(fù)</span></strong><strong><span style="color:#993300;">1</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"; color:#993300;">錛屽垯鍙︿袱涓暟鍦?/span></strong><strong><span style="color:#993300;"> +n</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";color:#993300;">浣嶄笂蹇呯劧涓涓負(fù)</span></strong><strong><span style="color:#993300;">1</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";color:#993300;">錛屽彟涓涓負(fù)</span></strong><strong><span style="color:#993300;">0</span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛堜笉鐒剁殑璇濓紝榪欎笁涓暟鐨勫紓鎴栧煎氨涓嶄細(xì)涓?/span>0<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛夛紝<strong><span style="color:#993300">鍥犺屾牴鎹?/span></strong></span><strong><span style="color:#993300;"> +n</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";color:#993300;">浣嶄負(fù)</span></strong><strong><span style="color:#993300;">1</span></strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";color:#993300;">錛屽彲浠ュ皢榪欎笁涓暟鍒嗘垚涓ら儴鍒?/span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span> </p> <p style="text-indent:21.0pt;"> </p> <p style="text-indent:21.1pt;"><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">璁?/span></strong><strong>f(x)</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">涓?/span></strong><strong>x</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鐨勪簩榪涘埗琛ㄧず涓渶浣庝綅</span></strong><strong>1</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鐨勪綅緗紝鍒?/span></strong><strong>f(a)</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></strong><strong>f(b)</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></strong><strong>f(c)</strong><strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">榪欎笁涓暟涓湁涓斿彧鏈変袱涓暟鐩哥瓑</span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傝瘉鏄庯細(xì)涓嶅Θ璁?/span>f(a)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>f(b)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>f(c)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">涓渶灝忕殑鏄?/span>f(a)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛?/span>k = f(a)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽垯</span>b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span>c<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍦?/span> +k<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶄笂蹇呯劧鏄竴涓負(fù)</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屼竴涓負(fù)</span>0<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屼笉濡ㄨ</span>b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍦?/span> +k<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶄負(fù)</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽垯鏍規(guī)嵁</span>f(x)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鐨勫畾涔変互鍙?/span>f(a)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鏈灝忥紝鍙緱</span>f(b)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">絳変簬</span>f(a)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛?/span>f(c)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">澶т簬</span>f(a)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傚洜鑰岋紝鏂版暟緇勭殑鏁?/span>x<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">瀵瑰簲鐨勬墍鏈?/span>f(x)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鐨勬誨紓鎴栧肩瓑浜?/span>f(c)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆?/span></p> <p style="text-indent:21.0pt;"> </p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍋囪</span>f(a)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">絳変簬</span>f(b)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛?/span>m = f(c)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛岀敱浜?/span>c<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍦?/span> +m<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶄笂涓?/span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屼笉濡ㄨ</span> b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍦?/span> +m<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶄篃涓?/span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽垯</span>a<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍦?/span> +m<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶄負(fù)</span>0<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">銆傛牴鎹?/span> +m<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶆槸鍚︿負(fù)</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽彲灝嗘柊鏁扮粍鍒嗕負(fù)涓ら儴鍒嗭紝姣忛儴鍒嗙殑寮傛垨鍊兼伆濂介兘鏄?/span><span> <span>a = B xor C</span></span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屽彲浠ユ眰鍑烘暟</span>A<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛堢瓑浜?/span>a xor X<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛夈?/span><span> </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">灝嗘暟</span>A<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鏀懼叆鍘熸潵鐨勬暟緇勶紝闂杞負(fù)</span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">“鍙湁涓や釜鏁板嚭鐜頒竴嬈?#8221;鐨勬儏鍐碉紝鍒╃敤鍓嶉潰鎻愬埌鐨勬柟娉曠畻鍑哄彟涓や釜鏁般傛誨叡闇閬嶅巻鏁扮粍</span>4<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">嬈°?/span></p> <p> </p> <p> </p> <p><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浠g爜錛?/span> </p> <p> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:#804000">#include <cstdio></span></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:#804000">#include <cassert></span></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">static</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">inline</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> extract_rightmost_one</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">unsigned</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> value</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">{</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:blue">return</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> value </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">&</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">-</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">value</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">}</span></strong></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:green">// if a != b, m = extract_rightmost_one(a), n = extract_rightmost_one(b),</span></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:green">//             k = extract_rightmost_one(a ^ b)</span></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:green">// then m == n != k   or<span>   </span>m == k != n   or n == k != m</span></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">void</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> print_three_unique_number</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> arr</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">[],</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">unsigned</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> len</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong></p> <p style="text-autospace:none"><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">{</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> assert </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">len </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">>=</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#FF8000">3</span> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">&&</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> len </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">%</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#FF8000">2</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">);</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> beg </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> arr</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> end </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> arr </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">+</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> len</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor3 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#FF8000">0</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:blue">for</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#8000FF">int</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> beg</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">!=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> end</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">++</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor3 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^=</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> flag1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#FF8000">0</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:blue">for</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#8000FF">int</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> beg</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">!=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> end</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">++</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> flag1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> extract_rightmost_one</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor3</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">);</span></strong></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> assert</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">flag1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">!=</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#FF8000">0</span> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">&&</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">flag1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">&</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">flag1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">-</span></strong> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#FF8000">1u</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">))</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">==</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#FF8000">0u</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">);</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå; color:green">// flag1 == 2^^k</span></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor2 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#FF8000">0</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:blue">for</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#8000FF">int</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> beg</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">!=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> end</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">++</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">{</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">    </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> value </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor3</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">    </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:blue">if</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">value </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">&</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> flag1</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor2 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> value</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:green">//or:</span></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">    </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:green">// if ((value & flag1) == 0) xor2 ^= value;</span></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">}</span></strong></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor2 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor3</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> flag2 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> extract_rightmost_one</span><strong><span style="font-size:9.0pt;font-family: ËÎÌå;color:navy">(</span></strong><span style="font-size: 9.0pt;font-family:ËÎÌå; color:black">xor2</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">);</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number2 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">number1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">&</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> flag2</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">?</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number1 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">:</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#FF8000">0</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong> <span style="font-size:9.0pt;font-family:ËÎÌå;color:green">// </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:green;">put</span><span style="font-size:9.0pt; font-family:ËÎÌå;color:green"> number1 </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:green;">in</span><span style="font-size: 9.0pt;font-family:ËÎÌå; color:green">to the array</span></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:blue">for</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt; font-family:ËÎÌå;color:#8000FF">int</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> beg</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">!=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> end</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">++</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">{</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">    </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:blue">if</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">&</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> flag2</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">)</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number2 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^=</span></strong> <strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">*</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black">p</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">}</span></strong></p> <p style="text-autospace:none"> </p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> </span><span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">const</span> <span style="font-size:9.0pt;font-family:ËÎÌå;color:#8000FF">int</span><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number3 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">=</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> xor2 </span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">^</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number2</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">;</span></strong></p> <p style="text-autospace:none"><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> printf</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">(</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:gray">"%d %d %d\n"</span><strong><span style="font-size:9.0pt;font-family: ËÎÌå;color:navy">,</span></strong><span style="font-size: 9.0pt;font-family:ËÎÌå; color:black"> number1</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">,</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number2</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">,</span></strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:black"> number3</span><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">);</span></strong></p> <p style="text-autospace:none"><strong><span style="font-size:9.0pt;font-family:ËÎÌå;color:navy">}</span></strong></p> <p style="text-autospace:none"><strong> </strong></p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">涓婇潰鐨勪唬鐮佸茍涓嶄弗鏍肩鍚?/span>C++<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鏍囧噯錛岃屾槸鍋囧畾鏈哄櫒閲囩敤琛ョ爜琛ㄧず璐熸暟錛堜笉閲囩敤琛ョ爜琛ㄧず鐨勮佸彜钁o紝涓鑸漢涔熺涓嶅埌錛夈?/span> <span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">鍙﹀瑕佺壒鍒敞鎰忕殑鏄紝涓浜涜綆楁渶濂藉厛杞負(fù)鏃犵鍙鋒暟錛岄伩鍏嶆孩鍑猴紝鏈鍚庡啀杞洖鏈夌鍙鋒暟銆傚洜涓烘爣鍑嗗亣瀹氭湁絎﹀彿鏁伴棿鐨勮綆椾笉鍙戠敓婧㈠嚭錛屽綋瀹為檯涓婂彂鐢熸孩鍑烘椂錛屽氨鏄?/span>UB<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">琛屼負(fù)錛岀紪璇戝櫒鑻ヨ繘琛屼簺嬋榪涚殑浼樺寲灝卞緱涓嶅埌姝g‘緇撴灉銆?/span></p> <p style="text-indent:21.0pt;"> </p><img src ="http://www.shnenglu.com/flyinghearts/aggbug/198695.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2013-03-21 22:00 <a href="http://www.shnenglu.com/flyinghearts/archive/2013/03/21/198695.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>mingw gcc鐨勫ご鏂囦歡瀛樺湪緇撴瀯瀹氫箟閿欒錛侊紒http://www.shnenglu.com/flyinghearts/archive/2013/03/21/198694.htmlflyingheartsflyingheartsThu, 21 Mar 2013 13:51:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2013/03/21/198694.htmlhttp://www.shnenglu.com/flyinghearts/comments/198694.htmlhttp://www.shnenglu.com/flyinghearts/archive/2013/03/21/198694.html#Feedback0http://www.shnenglu.com/flyinghearts/comments/commentRss/198694.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/198694.html鍑嗙‘鐨勮鏄痬ingw鎵鐢ㄧ殑sdk ——  w32api錛屽瓨鍦ㄧ粨鏋勫畾涔夐敊璇?br /> 
 鎵撳紑wingdi.h 瀹氫綅鍒?tagGCP_RESULTSW 鐨勭粨鏋勫畾涔変綅緗紝
 
  typedef struct tagGCP_RESULTSW {
    DWORD lStructSize;
    LPWSTR lpOutString;
    UINT *lpOrder;
    int *lpDx;
    int *lpCaretPos;
    LPWSTR lpClass;         //姝g‘鐨勭被鍨嬪簲璇ユ槸 LPSTR
    LPWSTR lpGlyphs;
    UINT nGlyphs;
    int nMaxFit;
  } GCP_RESULTSW,*LPGCP_RESULTSW;

 鏍規(guī)嵁msdn, lpClass鐨勭被鍨嬪簲璇ユ槸 LPSTR錛?w32api鍗村皢鍏跺0鏄庝負(fù) LPWSTR銆?br /> 
  榪欎釜bug錛屽湪2011騫村氨鏈変漢鎶ュ憡浜嗭紝鎹cvs鐗堟湰涔熶慨姝d簡錛屼絾鏄洿鍒扮幇鍦紝瀹樻柟涓嬭澆榪樻槸2011騫村彂甯冪殑閭d釜鏈塨ug鐨勭増鏈紙w32api-3.17-2-mingw32-dev.tar.lzma錛夈?br /> 
  鍙﹀錛宮ingw-w64錛堟敮鎸佺敓鎴?2浣嶃?4浣嶇▼搴忥級涓嶅瓨鍦ㄨ繖涓棶棰樸?

 



]]>
c++11 鏈鍙嶇洿瑙夌殑鍦版柟http://www.shnenglu.com/flyinghearts/archive/2012/11/22/195570.htmlflyingheartsflyingheartsThu, 22 Nov 2012 11:49:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2012/11/22/195570.htmlhttp://www.shnenglu.com/flyinghearts/comments/195570.htmlhttp://www.shnenglu.com/flyinghearts/archive/2012/11/22/195570.html#Feedback4http://www.shnenglu.com/flyinghearts/comments/commentRss/195570.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/195570.html
1 auto 浼?xì)鑷姩鎶?寮曠敤 鍘婚櫎鎺?br /> 
  int& get();
  auto k = get();     // k鐨勭被鍨嬫槸int錛岃屼笉鏄痠nt&
 
  Derived object;
  auto&    same_object = (Base&)object;      
  auto  another_object = (Base&)object;  //浼?xì)閲嶆柊鏋勯犱釜Base瀵硅薄  
 
    
2 decltype 鏈夋椂浼?xì)鑷姩鎶?寮曠敤 鍔犱笂

  int x;
  decltype((x)) 鍜?decltype(*&x) 鐨勭被鍨嬫槸int&錛岃屼笉鏄痠nt
 
  鍦ㄥ畯涓嬌鐢╠ecltype鏃訛紝瑕佺壒鍒敞鎰忓埆澶氬姞浜嗘嫭鍙楓?br /> 
  涓嬮潰榪欐浠g爜閿欏湪鍝噷錛?br />    template<typename T, typename R>
    auto min(T t, R r) -> decltype(t < r ? t : r)
    {
      return (t < r ? t : r);
    }
    
  decltype(t < r ? t : r)鐨勭被鍨嬫槸T&鎴朢&錛岃屼笉鏄墍甯屾湜鐨凾鎴朢錛?br /> 
 
  鏍囧噯鏄繖鏍瘋瀹氱殑錛?br />
The type denoted by decltype(e) is defined as follows:
  — if e is an unparenthesized id-expression or an unparenthesized class member
     access (5.2.5), decltype(e) is the type of the entity named by e. If there
     is no such entity, or if e names a set of overloaded functions, the program
     is ill-formed;
  — otherwise, if e is an xvalue, decltype(e) is T&&, where T is the type of e;
  — otherwise, if e is an lvalue, decltype(e) is T&, where T is the type of e;
  — otherwise, decltype(e) is the type of e.
 

3 std::move銆乻td::forward銆佸彸鍊煎紩鐢?br /> 
  C++11 寮曞叆 鍙沖煎紩鐢紝鍙互鍋氬埌錛氬嚱鏁拌漿鍙戙侀拡瀵逛復(fù)鏃跺璞′紭鍖?br />  move鏄姩璇嶏紝浠庡瓧闈笂鐞嗚В濂藉儚鏄縐誨姩瀵硅薄錛屽叾瀹瀞td::move鍙槸綆鍗曠殑灝嗙被鍨嬭漿鎴愬彸鍊煎紩鐢ㄨ屽凡錛侊紒錛?鍙互鐞嗚В鎴?cast_to_rvalue_reference 鎴?treat_as_temporal_object銆?br /> 

  void test1(int&&) {}
 
  void test2(int&& value)  //娉ㄦ剰錛歷alue鐨勭被鍨嬫槸int錛岃屼笉鏄痠nt&&
  {
     test1(value);    //鏃犳硶緙栬瘧閫氳繃錛屽洜涓簐alue鐨勭被鍨嬫槸int錛?蹇呴』杞崲綾誨瀷
     test1(static_cast<int&&>(value));      //鎴栬?br />     test1(std::forward<int>(value));
  }
 
  test2鍑芥暟涓紝value鐨勭被鍨嬫槸int錛岃屼笉鏄痠nt&&銆?br />  榪欐槸涓涓笉寰楀凡鐨勯夋嫨銆傚鏋渧alue鐨勭被鍨嬫槸int&&鐨勮瘽錛屽氨浼?xì)鏈夊壇浣滅敤锛?xì)
 
  void increase(int& value) { ++value; }
  void test3(int&& value) { increase(value); }
 
  char ch = 'a';
  test3(ch);  //鏈剰鏄敼鍙榗h鍊鹼紝浣嗗疄闄呬笂ch鍊間笉浼?xì)鏀瑰彉锛屾敼鍙樼殑鏄复鏃跺鍍?br />  閫氳繃杞彂鍑芥暟test3錛宨ncrease鍑芥暟鍙互淇敼涓存椂瀵瑰儚錛?br />  榪欓犳垚紼嬪簭鍛樼姱鐨勯敊璇紙濡備笂闈㈢殑渚嬪瓙錛夛紝闅句互鍦ㄧ紪璇戞椂灝辮鎵懼嚭鏉ャ?br /> 
 
  std::forward<T>(value) 絳変環(huán)浜?static_cast<T&&>(value)錛屾劅瑙夊悗鑰呮洿瀹規(guī)槗鐞嗚В銆?br />  std::forward 璧峰埌鐨勮漿鍙戜綔鐢ㄣ傚鏋淭綾誨瀷涓?R&銆?R&&錛岀粡榪囩被鍨嬭漿鎹㈠悗錛屽叾綾誨瀷榪樻槸鍜屽師鏉ョ殑涓鏍楓?br />  鍦–++11涓?
    R&  &   絳夊悓浜?R&   錛堝湪c++03涓紝R& &榪欑鍐欐硶鏄潪娉曠殑錛?br />    R&& &   絳夊悓浜?R&
    R&  &&  絳夊悓浜?R&
    R&& &&  絳夊悓浜?R&&
 

]]>
decltype鐨勫皬鈥滈櫡闃扁?/title><link>http://www.shnenglu.com/flyinghearts/archive/2012/08/14/187204.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Tue, 14 Aug 2012 13:19:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2012/08/14/187204.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/187204.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2012/08/14/187204.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/187204.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/187204.html</trackback:ping><description><![CDATA[int x;<br /><div>decltype(x) 鍜?nbsp; decltype((x))    鐨勭被鍨嬫槸涓嶄竴鏍風(fēng)殑銆?/div><div>decltype(x) 鍜?nbsp; decltype(*&x)   鐨勭被鍨嬫槸涓嶄竴鏍風(fēng)殑銆?br /><div></div><br /><div>decltype(x)鐨勭被鍨嬫槸 int<br />decltype((x)) 鍜?decltype(*&x)  鐨勭被鍨嬫槸 int&<br /><div><br />C++11鏍囧噯錛?/div></div></div><div>The type denoted by decltype(e) is defined as follows:<br />  — if e is an unparenthesized id-expression or an unparenthesized class member<br />     access (5.2.5), decltype(e) is the type of the entity named by e. If there<br />     is no such entity, or if e names a set of overloaded functions, the program<br />     is ill-formed;<br />  — otherwise, if e is an xvalue, decltype(e) is T&&, where T is the type of e;<br />  — otherwise, if e is an lvalue, decltype(e) is T&, where T is the type of e;<br />  — otherwise, decltype(e) is the type of e.</div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/187204.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-08-14 21:19 <a href="http://www.shnenglu.com/flyinghearts/archive/2012/08/14/187204.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍐呭祵姹囩紪瀹炵幇鐨勫嚱鏁拌漿鍙?/title><link>http://www.shnenglu.com/flyinghearts/archive/2012/08/05/186382.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Sun, 05 Aug 2012 13:02:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2012/08/05/186382.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/186382.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2012/08/05/186382.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/186382.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/186382.html</trackback:ping><description><![CDATA[  寮勭潃鐜╃殑銆傚姛鑳芥槸綆鍗曠殑瀹炵幇鍑芥暟杞彂錛屽嵆<br />      璋冪敤CALL(func)錛岃漿涓鴻皟鐢╢unc()錛?div>      璋冪敤CALL(func, arg1, arg2) 錛岃漿涓鴻皟鐢╢unc(arg1, arg2)</div><br /><div>  浠g爜涓紝瀹廋ALL/STDCALL鍒嗗埆鐢ㄦ潵璋冪敤  __cdecl/__stdcall 璋冪敤瑙勫畾鐨勫嚱鏁?br />             unsafe_call 涓よ呴兘鍙皟鐢紝浣嗗畠涓嶆槸澶氱嚎紼嬪畨鍏ㄧ殑銆?br /><br />  浠g爜鍙敮鎸亁86 32浣嶏紝 闄ゅ唴宓屾眹緙栭儴鍒嗭紝灝介噺絎﹀悎C++11鏍囧噯銆?br />       </div>鍘熺悊錛?br />     鍒氳繘鍏ュ嚱鏁版椂錛?br />     [esp]           鍑芥暟榪斿洖鍦板潃<br />     [esp + 4]     絎竴涓弬鏁幫紝鍗寵漿鍙戝嚱鏁扮殑鍦板潃<br /><div>     [esp + 8]     絎簩涓弬鏁幫紝鍗寵漿鍙戝嚱鏁扮殑鐨勭涓涓弬鏁?/div>     ...  <br />    <br />      鍙鍐欎笁琛屾眹緙栨寚浠ゅ疄鐜頒竴涓猚_call鍑芥暟錛屽氨鍙皟鐢ㄨ漿鍙戝嚱鏁?br /><div>      pop eax                             ; eax涓哄嚱鏁拌繑鍥炲湴鍧<br />      xchg dword ptr[esp], eax     ; eax涓鴻漿鍙戝嚱鏁扮殑鍦板潃錛孾esp]涓哄嚱鏁拌繑鍥炲湴鍧<br />      jmp eax<br />      <br /><div>     褰撹漿鍙戝嚱鏁版槸__cdecl錛屽嵆杞彂鍑芥暟涓嶄細(xì)璋冭妭鏍堬紝鐢變簬鍦╟_call錛宲op eax錛屼嬌esp澶氬姞浜?錛屽洜鑰屽湪璋冪敤瀹宑_call鍚庡簲璇ユ墜鍔ㄥ皢esp鍊煎噺4錛屼繚璇佹爤騫寵 銆?br />    <div>    褰撹漿鍙戝嚱鏁版槸__stdcall錛岃漿鍙戝嚱鏁頒細(xì)璋冭妭鏍堬紝璋冪敤杞彂鍑芥暟瀹屾瘯鍚庯紝鏍堝凡緇忎繚鎸佸鉤琛★紝鍥犺岃皟鐢╟_call瀹屾瘯錛屼笉搴旇榪涜鏍堟寚閽堣皟鑺傘備技涔庡皢c_call鐨勮皟鐢ㄦ敼涓篲_stdcall鍗沖彲錛屼絾瀹為檯涓奵_call鏈夊彉闀垮弬鏁幫紝鏀規(guī)垚__stdcall娌℃晥鏋滐紝姣忔璋冪敤緙栬瘧鍣ㄨ繕鏄細(xì)鑷姩鐢熸垚璋冭妭鏍堟寚閽堜唬鐮併傚洜鑰屽彧鑳芥瘡嬈¤皟鐢ㄥ畬姣曪紝緙栬瘧鍣ㄧ粰esp鍔犱簡澶氬皯錛屽氨鎵嬪姩鍑忓灝戙傦紙緙栬瘧鍣ㄤ笉涓瀹氫細(xì)鐢熸垚 call  xxxx; add esp, xx榪欐牱鐨勪唬鐮侊紝閫氳繃鏀瑰嚱鏁拌繑鍥炲湴鍧錛屽拷鐣ュ悗闈㈢殑add esp, xx鎸囦護鏄緢緋熺硶鐨勫仛娉曘傦級</div></div> </div><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><img id="Code_Closed_Image_202018" onclick="this.style.display='none'; Code_Closed_Text_202018.style.display='none'; Code_Open_Image_202018.style.display='inline'; Code_Open_Text_202018.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" height="16" align="top" width="11"><img id="Code_Open_Image_202018" style="display: none" onclick="this.style.display='none'; Code_Open_Text_202018.style.display='none'; Code_Closed_Image_202018.style.display='inline'; Code_Closed_Text_202018.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" height="16" align="top" width="11"><span id="Code_Closed_Text_202018" style="border-right: #808080 1px solid; border-top: #808080 1px solid; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">call_redirect</span><span id="Code_Open_Text_202018" style="display: none"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080; ">  1</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstdio</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #008080; ">  2</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cstdarg</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #008080; ">  3</span> <span style="color: #000000; ">#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">windows.h</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #008080; ">  4</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">  5</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> CALL(<img src="http://www.shnenglu.com/Images/dot.gif" alt="" />)    c_call(__VA_ARGS__); ASM_SUB_ESP(4);</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">  6</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> STDCALL(<img src="http://www.shnenglu.com/Images/dot.gif" alt="" />) c_call(__VA_ARGS__); ASM_SUB_ESP(MACRO_ARGS(__VA_ARGS__) * 4);</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">  7</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">  8</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> MACRO_EXPAND(x) x</span><span style="color: #000000; "><br /></span><span style="color: #008080; ">  9</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> MACRO_NTH_ARG(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, <img src="http://www.shnenglu.com/Images/dot.gif" alt="" />) a9</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 10</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> MACRO_ARGS(<img src="http://www.shnenglu.com/Images/dot.gif" alt="" />) \</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 11</span> <span style="color: #000000; ">    MACRO_EXPAND(MACRO_NTH_ARG(__VA_ARGS__, </span><span style="color: #000000; ">9</span><span style="color: #000000; ">, </span><span style="color: #000000; ">8</span><span style="color: #000000; ">, </span><span style="color: #000000; ">7</span><span style="color: #000000; ">, </span><span style="color: #000000; ">6</span><span style="color: #000000; ">, </span><span style="color: #000000; ">5</span><span style="color: #000000; ">, </span><span style="color: #000000; ">4</span><span style="color: #000000; ">, </span><span style="color: #000000; ">3</span><span style="color: #000000; ">, </span><span style="color: #000000; ">2</span><span style="color: #000000; ">, </span><span style="color: #000000; ">1</span><span style="color: #000000; ">, </span><span style="color: #000000; ">0</span><span style="color: #000000; ">))<br /></span><span style="color: #008080; "> 12</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 13</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#if</span><span style="color: #000000; ">  __GNUC__</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 14</span> <span style="color: #000000; ">  </span><span style="color: #008000; ">//</span><span style="color: #008000; "> please enable option, -masm=intel</span><span style="color: #008000; "><br /></span><span style="color: #008080; "> 15</span> <span style="color: #008000; "></span><span style="color: #000000; ">  </span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> ASM_SUB_ESP(x) asm("lea esp, dword ptr[esp - %0]" : : "i"(x))</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 16</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 17</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> c_call(</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; "> pfn, <img src="http://www.shnenglu.com/Images/dot.gif" alt="" />) asm(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">c_call</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; "> 18</span> <span style="color: #000000; ">  asm(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">                          \n\</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 19</span> <span style="color: #000000; "></span><span style="color: #000000; ">    c_call:                      \n\<br /></span><span style="color: #008080; "> 20</span> <span style="color: #000000; ">      pop eax;                   \n\<br /></span><span style="color: #008080; "> 21</span> <span style="color: #000000; ">      xchg dword ptr[esp], eax;  \n\<br /></span><span style="color: #008080; "> 22</span> <span style="color: #000000; ">      jmp eax;                   \n\<br /></span><span style="color: #008080; "> 23</span> <span style="color: #000000; ">  </span><span style="color: #000000; ">"</span><span style="color: #000000; ">);</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 24</span> <span style="color: #000000; "></span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 25</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> unsafe_call(</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; "> pfn, <img src="http://www.shnenglu.com/Images/dot.gif" alt="" />)  asm(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">unsafe_call</span><span style="color: #000000; ">"</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; "> 26</span> <span style="color: #000000; ">  asm(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">                                   \n\</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 27</span> <span style="color: #000000; "></span><span style="color: #000000; ">      .lcomm old_ret_addr, </span><span style="color: #000000; ">4</span><span style="color: #000000; ">              \n\<br /></span><span style="color: #008080; "> 28</span> <span style="color: #000000; ">      .lcomm old_esp_value,</span><span style="color: #000000; ">4</span><span style="color: #000000; ">              \n\<br /></span><span style="color: #008080; "> 29</span> <span style="color: #000000; ">    unsafe_call:                          \n\<br /></span><span style="color: #008080; "> 30</span> <span style="color: #000000; ">      pop  dword ptr old_ret_addr;        \n\<br /></span><span style="color: #008080; "> 31</span> <span style="color: #000000; ">      mov  dword ptr old_esp_value, esp;  \n\<br /></span><span style="color: #008080; "> 32</span> <span style="color: #000000; ">      mov eax, dword ptr[esp];            \n\<br /></span><span style="color: #008080; "> 33</span> <span style="color: #000000; ">      mov dword ptr[esp], offset last;    \n\<br /></span><span style="color: #008080; "> 34</span> <span style="color: #000000; ">      jmp eax;                            \n\<br /></span><span style="color: #008080; "> 35</span> <span style="color: #000000; ">    last:                                 \n\<br /></span><span style="color: #008080; "> 36</span> <span style="color: #000000; ">      mov esp, dword ptr old_esp_value;   \n\<br /></span><span style="color: #008080; "> 37</span> <span style="color: #000000; ">      jmp  dword ptr old_ret_addr;        \n\<br /></span><span style="color: #008080; "> 38</span> <span style="color: #000000; ">  </span><span style="color: #000000; ">"</span><span style="color: #000000; ">);</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 39</span> <span style="color: #000000; "></span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 40</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#elif</span><span style="color: #000000; ">  _MSC_VER</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 41</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> ASM_SUB_ESP(x) __asm lea esp, dword ptr [esp - x]</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 42</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 43</span> <span style="color: #000000; ">  __declspec(naked) </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> c_call(</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; "> pfn, <img src="http://www.shnenglu.com/Images/dot.gif" alt="" />)<br /></span><span style="color: #008080; "> 44</span> <span style="color: #000000; ">  {<br /></span><span style="color: #008080; "> 45</span> <span style="color: #000000; ">    __asm {<br /></span><span style="color: #008080; "> 46</span> <span style="color: #000000; ">      pop eax;<br /></span><span style="color: #008080; "> 47</span> <span style="color: #000000; ">      xchg dword ptr[esp], eax;<br /></span><span style="color: #008080; "> 48</span> <span style="color: #000000; ">      jmp eax;<br /></span><span style="color: #008080; "> 49</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; "> 50</span> <span style="color: #000000; ">  }<br /></span><span style="color: #008080; "> 51</span> <span style="color: #000000; ">  __declspec(naked) </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> unsafe_call(</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; "> pfn, <img src="http://www.shnenglu.com/Images/dot.gif" alt="" />)<br /></span><span style="color: #008080; "> 52</span> <span style="color: #000000; ">  {<br /></span><span style="color: #008080; "> 53</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; "> old_ret_addr;<br /></span><span style="color: #008080; "> 54</span> <span style="color: #000000; ">    </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; "> old_esp_value;<br /></span><span style="color: #008080; "> 55</span> <span style="color: #000000; ">    __asm {<br /></span><span style="color: #008080; "> 56</span> <span style="color: #000000; ">      pop  old_ret_addr;<br /></span><span style="color: #008080; "> 57</span> <span style="color: #000000; ">      mov  old_esp_value, esp;<br /></span><span style="color: #008080; "> 58</span> <span style="color: #000000; ">      mov eax, dword ptr[esp];<br /></span><span style="color: #008080; "> 59</span> <span style="color: #000000; ">      mov dword ptr[esp], offset last;<br /></span><span style="color: #008080; "> 60</span> <span style="color: #000000; ">      jmp eax;<br /></span><span style="color: #008080; "> 61</span> <span style="color: #000000; ">    last:<br /></span><span style="color: #008080; "> 62</span> <span style="color: #000000; ">      mov esp, old_esp_value;<br /></span><span style="color: #008080; "> 63</span> <span style="color: #000000; ">      jmp  old_ret_addr;<br /></span><span style="color: #008080; "> 64</span> <span style="color: #000000; ">    }<br /></span><span style="color: #008080; "> 65</span> <span style="color: #000000; ">  }<br /></span><span style="color: #008080; "> 66</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 67</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#else</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 68</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">#error</span><span style="color: #000000; "> "only gcc and msvc are supported"</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 69</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">#endif</span><span style="color: #000000; "><br /></span><span style="color: #008080; "> 70</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 71</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 72</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> show(</span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">char</span><span style="color: #000000; ">*</span><span style="color: #000000; "> format, <img src="http://www.shnenglu.com/Images/dot.gif" alt="" />)<br /></span><span style="color: #008080; "> 73</span> <span style="color: #000000; ">{<br /></span><span style="color: #008080; "> 74</span> <span style="color: #000000; ">  va_list args;<br /></span><span style="color: #008080; "> 75</span> <span style="color: #000000; ">  va_start(args, format);<br /></span><span style="color: #008080; "> 76</span> <span style="color: #000000; ">  vprintf(format, args);<br /></span><span style="color: #008080; "> 77</span> <span style="color: #000000; ">  va_end (args);<br /></span><span style="color: #008080; "> 78</span> <span style="color: #000000; ">}<br /></span><span style="color: #008080; "> 79</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 80</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> mysleep() { Sleep(</span><span style="color: #000000; ">10</span><span style="color: #000000; ">); }<br /></span><span style="color: #008080; "> 81</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 82</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> test1()<br /></span><span style="color: #008080; "> 83</span> <span style="color: #000000; ">{<br /></span><span style="color: #008080; "> 84</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> a </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">5</span><span style="color: #000000; ">, b </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">6</span><span style="color: #000000; ">;<br /></span><span style="color: #008080; "> 85</span> <span style="color: #000000; ">  show(</span><span style="color: #000000; ">"</span><span style="color: #000000; ">%d + %d = %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, a, b, a </span><span style="color: #000000; ">+</span><span style="color: #000000; "> b);<br /></span><span style="color: #008080; "> 86</span> <span style="color: #000000; ">  CALL((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)printf, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">%d + %d = %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, a, b, a </span><span style="color: #000000; ">+</span><span style="color: #000000; "> b);<br /></span><span style="color: #008080; "> 87</span> <span style="color: #000000; ">  CALL((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)mysleep);<br /></span><span style="color: #008080; "> 88</span> <span style="color: #000000; ">  CALL((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)show,   </span><span style="color: #000000; ">"</span><span style="color: #000000; ">%d + %d = %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, a, b, a </span><span style="color: #000000; ">+</span><span style="color: #000000; "> b);<br /></span><span style="color: #008080; "> 89</span> <span style="color: #000000; ">}<br /></span><span style="color: #008080; "> 90</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 91</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> test2()<br /></span><span style="color: #008080; "> 92</span> <span style="color: #000000; ">{<br /></span><span style="color: #008080; "> 93</span> <span style="color: #000000; ">  STDCALL((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)MessageBoxA, NULL, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">text1</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">caption1</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, MB_OK);<br /></span><span style="color: #008080; "> 94</span> <span style="color: #000000; ">  STDCALL((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)Sleep, </span><span style="color: #000000; ">10</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; "> 95</span> <span style="color: #000000; ">  STDCALL((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)MessageBoxA, NULL, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">text2</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">caption2</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, MB_OK);<br /></span><span style="color: #008080; "> 96</span> <span style="color: #000000; ">  STDCALL((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)Sleep, </span><span style="color: #000000; ">100</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; "> 97</span> <span style="color: #000000; ">}<br /></span><span style="color: #008080; "> 98</span> <span style="color: #000000; "><br /></span><span style="color: #008080; "> 99</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">void</span><span style="color: #000000; "> test3()<br /></span><span style="color: #008080; ">100</span> <span style="color: #000000; ">{<br /></span><span style="color: #008080; ">101</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> a </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">5</span><span style="color: #000000; ">, b </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">6</span><span style="color: #000000; ">;<br /></span><span style="color: #008080; ">102</span> <span style="color: #000000; ">  unsafe_call((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)printf, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">%d + %d = %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, a, b, a </span><span style="color: #000000; ">+</span><span style="color: #000000; "> b);<br /></span><span style="color: #008080; ">103</span> <span style="color: #000000; ">  unsafe_call((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)mysleep);<br /></span><span style="color: #008080; ">104</span> <span style="color: #000000; ">  unsafe_call((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)show,   </span><span style="color: #000000; ">"</span><span style="color: #000000; ">%d + %d = %d\n</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, a, b, a </span><span style="color: #000000; ">+</span><span style="color: #000000; "> b);<br /></span><span style="color: #008080; ">105</span> <span style="color: #000000; ">  unsafe_call((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)MessageBoxA, NULL, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">text1</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">caption1</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, MB_OK);<br /></span><span style="color: #008080; ">106</span> <span style="color: #000000; ">  unsafe_call((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)Sleep, </span><span style="color: #000000; ">10</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">107</span> <span style="color: #000000; ">  unsafe_call((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)MessageBoxA, NULL, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">text2</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, </span><span style="color: #000000; ">"</span><span style="color: #000000; ">caption2</span><span style="color: #000000; ">"</span><span style="color: #000000; ">, MB_OK);<br /></span><span style="color: #008080; ">108</span> <span style="color: #000000; ">  unsafe_call((</span><span style="color: #0000FF; ">void</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)Sleep, </span><span style="color: #000000; ">100</span><span style="color: #000000; ">);<br /></span><span style="color: #008080; ">109</span> <span style="color: #000000; ">}<br /></span><span style="color: #008080; ">110</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">111</span> <span style="color: #000000; "></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main()<br /></span><span style="color: #008080; ">112</span> <span style="color: #000000; ">{<br /></span><span style="color: #008080; ">113</span> <span style="color: #000000; ">  test1();<br /></span><span style="color: #008080; ">114</span> <span style="color: #000000; ">  test2();<br /></span><span style="color: #008080; ">115</span> <span style="color: #000000; ">  test3();<br /></span><span style="color: #008080; ">116</span> <span style="color: #000000; ">  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br /></span><span style="color: #008080; ">117</span> <span style="color: #000000; ">}<br /></span><span style="color: #008080; ">118</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">119</span> <span style="color: #000000; "><br /></span><span style="color: #008080; ">120</span> <span style="color: #000000; "></span></span></div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/186382.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-08-05 21:02 <a href="http://www.shnenglu.com/flyinghearts/archive/2012/08/05/186382.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓浜涜佹父鎴廋PU 100%鍗犵敤鐨勮В鍐蟲柟娉?/title><link>http://www.shnenglu.com/flyinghearts/archive/2012/05/15/175005.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Tue, 15 May 2012 12:26:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2012/05/15/175005.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/175005.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2012/05/15/175005.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/175005.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/175005.html</trackback:ping><description><![CDATA[<br />涓嬭澆錛?a href="/Files/flyinghearts/peekmsg.7z" title="peekmsg">peekmsg</a><br /><br /><div>鐢ㄦ硶錛?br />     peekmsg.exe   娓告垙涓葷▼搴?br />     鎴栫敤lordpe錛屾墦寮娓告垙涓葷▼搴忥紝瀵煎叆peekmsg.dll涓殑init<br /><br /> </div><div>鍘熺悊錛?br />       hook PeekMessage鍑芥暟錛岀敤Sleep銆乄aitForMultipleObjects絳夊嚱鏁拌鍑篊PU鏃墮棿鐗囥?<br /><br /> </div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/175005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-05-15 20:26 <a href="http://www.shnenglu.com/flyinghearts/archive/2012/05/15/175005.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓夊浗蹇?鍓ф湰淇敼鍣?1.2http://www.shnenglu.com/flyinghearts/archive/2012/05/15/175004.htmlflyingheartsflyingheartsTue, 15 May 2012 12:14:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2012/05/15/175004.htmlhttp://www.shnenglu.com/flyinghearts/comments/175004.htmlhttp://www.shnenglu.com/flyinghearts/archive/2012/05/15/175004.html#Feedback0http://www.shnenglu.com/flyinghearts/comments/commentRss/175004.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/175004.html鍐呯疆鍓ф湰鏀逛負(fù)鍔犲己鐗堝墽鏈紝淇濆瓨鍓ф湰鏃訛紝鍚屾椂鐢熸垚鏅氱増/鍔犲己鐗堝墽鏈?br />錛堟病鏃墮棿嫻嬭瘯錛屽彲鑳藉湪鏇存敼瀹濈墿鎵鏈夎呮椂錛屼細(xì)鏈変竴浜沚ug錛?br />
涓夊浗蹇?鍓ф湰淇敼鍣?.2
 

]]>
瀹夊叏鐨勬暣鏁版瘮杈?/title><link>http://www.shnenglu.com/flyinghearts/archive/2012/03/30/169554.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Fri, 30 Mar 2012 12:16:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2012/03/30/169554.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/169554.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2012/03/30/169554.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/169554.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/169554.html</trackback:ping><description><![CDATA[<br />鍓嶅嚑澶╁湪姘存瘝涓婄湅鍒扮殑棰橈細(xì)<br /><br /><div>姝e父鐨勬瘮杈?assert(-1 < 1U) 鏄細(xì)澶辮觸鐨勩傚洜涓?-1 浼?xì)鎻愬崌鎴愭棤绗﹀忎h暟銆?br />鍐欎竴涓畨鍏ㄧ殑姣旇緝鍑芥暟錛屼嬌寰?br />template <typename T1, typename T2><br />int SafeIntCompare(T1 i1, T2 i2);<br />濡傛灉 i1 鐪熷疄鍊?<  i2錛岃繑鍥?-1<br />     i1 鐪熷疄鍊?== i2錛岃繑鍥?nbsp; 0<br />     i1 鐪熷疄鍊?>  i2錛岃繑鍥?nbsp; 1</div><br /><br />鍙湁褰撲袱涓被鍨嬩竴涓槸鏈夌鍙楓佸彟涓涓槸鏃犵鍙鋒椂錛屾墠闇瑕佺壒孌婂鐞嗐?br />瀵圭被鍨嬬殑絎﹀彿鍒ゆ柇錛屽彲浠ョ洿鎺ュ垽鏂綾誨瀷鐨?1鏄惁姣?灝忥紝涔熷彲浠ョ敤鏍囧噯搴搒td::numeric_limits<T>涓殑is_signed鎴愬憳銆?br /><br />綆鍗曠殑鍋氭硶錛?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; ">template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> SafeIntCompare(T1 v1, T2 v2)<br />{<br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> t1 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> std::numeric_limits</span><span style="color: #000000; "><</span><span style="color: #000000; ">T1</span><span style="color: #000000; ">></span><span style="color: #000000; ">::is_signed;<br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> t2 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> std::numeric_limits</span><span style="color: #000000; "><</span><span style="color: #000000; ">T2</span><span style="color: #000000; ">></span><span style="color: #000000; ">::is_signed;<br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (t1 </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> t2) {<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (t1 </span><span style="color: #000000; ">&&</span><span style="color: #000000; "> v1 </span><span style="color: #000000; "><</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (t2 </span><span style="color: #000000; ">&&</span><span style="color: #000000; "> v2 </span><span style="color: #000000; "><</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />  }<br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v1 </span><span style="color: #000000; ">==</span><span style="color: #000000; "> v2) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v1 </span><span style="color: #000000; "><</span><span style="color: #000000; "> v2)  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />}</span></div><br /><div>浣嗙敱浜庤繘琛屾瘮杈冪殑涓や釜鏁板彲鑳藉垎鍒槸錛氭湁絎﹀彿鏁板拰鏃犵鍙鋒暟錛岀紪璇戞椂緙栬瘧鍣ㄤ細(xì)緇欏嚭澶ч噺鐨勮鍛娿?br /><br />     瑕侀伩鍏嶆湁絎﹀彿鏁板拰鏃犵鍙鋒暟鐨勮繘琛岀洿鎺ユ瘮杈冿紝灝卞繀欏誨皢瀹冧滑閮借漿涓哄悓涓涓被鍨婽銆傝繖涓被鍨嬬殑紜畾鍙互閲囩敤涓ょ鏂規(guī)硶錛?br /><br />     1 姣旇緝鍘熸潵涓や釜綾誨瀷鏄惁鏄湁絎﹀彿鏁頒互鍙婂畠浠墍鍗犵敤鐨勫瓧鑺傛暟錛屾潵鎺ㄦ柇鍑哄簲璇ュ皢瀹冧滑閮借漿涓哄摢縐嶇被鍨婽錛岃繖鏄痸c閭d釜safeint鐨勫仛娉曘?br /><br />     2 閲囩敤榪欎釜trick錛氬皢榪欎袱涓被鍨嬬殑鏁幫紙鏁板彲浠ュ彇0錛夌洿鎺ョ浉鍔狅紝寰楀埌鐨勭粨鏋滅殑綾誨瀷灝辨槸鎵姹傜殑銆傝繖鏄洜涓猴細(xì)涓や釜鏁拌繘琛屾瘮杈冩椂錛岄噰鐢ㄧ殑綾誨瀷杞崲瑙勫垯鍜屼袱涓暟鐩稿姞鏃舵墍閲囩敤鐨勮鍒欐槸涓鑷寸殑銆?br /><br /><br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><img id="Code_Closed_Image_195336" onclick="this.style.display='none'; Code_Closed_Text_195336.style.display='none'; Code_Open_Image_195336.style.display='inline'; Code_Open_Text_195336.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ContractedBlock.gif" height="16" width="11" align="top"><img id="Code_Open_Image_195336" style="display: none" onclick="this.style.display='none'; Code_Open_Text_195336.style.display='none'; Code_Closed_Image_195336.style.display='inline'; Code_Closed_Text_195336.style.display='inline';" src="http://www.shnenglu.com/images/OutliningIndicators/ExpandedBlockStart.gif" height="16" width="11" align="top"><span id="Code_Closed_Text_195336" style="border-right: #808080 1px solid; border-top: #808080 1px solid; border-left: #808080 1px solid; border-bottom: #808080 1px solid; background-color: #ffffff">鏀規(guī)垚鍚庣殑浠g爜</span><span id="Code_Open_Text_195336" style="display: none"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; "><br /><br /><br />template</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">bool</span><span style="color: #000000; ">></span><span style="color: #000000; "> </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> Assert {};<br />template</span><span style="color: #000000; "><></span><span style="color: #000000; "> </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> Assert</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">></span><span style="color: #000000; ">;<br /><br />template</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> is_first_negtive, </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> is_second_negtive</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> SafeIntCmpImpl<br />{<br />  template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> int_cmp(T1 v1, T2 v2)<br />  {<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v1 </span><span style="color: #000000; ">==</span><span style="color: #000000; "> v2) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v1  </span><span style="color: #000000; "><</span><span style="color: #000000; "> v2) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />  }<br />};<br /><br />template</span><span style="color: #000000; "><></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> SafeIntCmpImpl</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">, </span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />{<br />  template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2, typename T3</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> int_cmp(T1 v1, T2 v2, T3)<br />  {<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> SafeIntCmpImpl</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">, </span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">></span><span style="color: #000000; ">::int_cmp(T3(v1), T3(v2));<br />  }<br /><br />  template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> int_cmp(T1 v1, T2 v2)<br />  {<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> v1 </span><span style="color: #000000; "><</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; "> </span><span style="color: #000000; ">?</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; "> : int_cmp(v1, v2, T1(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">) </span><span style="color: #000000; ">+</span><span style="color: #000000; "> T2(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">));<br />  }<br />};<br /><br />template</span><span style="color: #000000; "><></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> SafeIntCmpImpl</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">, </span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />{<br />  template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> int_cmp(T1 v1, T2 v2)<br />  {<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">SafeIntCmpImpl</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">true</span><span style="color: #000000; ">, </span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">></span><span style="color: #000000; ">::int_cmp(v2, v1);<br />  }<br />};<br /><br /><br /><br />template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> SafeIntCompare(T1 v1, T2 v2)<br />{<br />  typedef std::numeric_limits</span><span style="color: #000000; "><</span><span style="color: #000000; ">T1</span><span style="color: #000000; ">></span><span style="color: #000000; "> M1;<br />  typedef std::numeric_limits</span><span style="color: #000000; "><</span><span style="color: #000000; ">T2</span><span style="color: #000000; ">></span><span style="color: #000000; "> M2;<br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> is_arg_valid </span><span style="color: #000000; ">=</span><span style="color: #000000; "> M1::is_integer </span><span style="color: #000000; ">&</span><span style="color: #000000; "> M2::is_integer;<br />  Assert</span><span style="color: #000000; "><</span><span style="color: #000000; ">is_arg_valid</span><span style="color: #000000; ">></span><span style="color: #000000; ">();<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> SafeIntCmpImpl</span><span style="color: #000000; "><</span><span style="color: #000000; ">M1::is_signed, M2::is_signed</span><span style="color: #000000; ">></span><span style="color: #000000; ">::int_cmp(v1, v2);<br />}<br /></span></span></div><br />  浣嗕笂闈㈢殑鍐欐硶鏈変竴涓棶棰橈細(xì)濡傛灉涓涓?short鍜屼竴涓猽nsigned char榪涜姣旇緝錛岀紪璇戝櫒閮芥槸杞負(fù)int榪涜姣旇緝錛屾病鏈夊繀瑕佽繘琛岀壒孌婂鐞嗭紙涓婇潰鐨勪唬鐮佸鐞嗗悗浼?xì)澶氫竴涓笌0鐨勬瘮杈冿級銆傚疄闄呬笂錛屽鏋滀袱涓被鍨嬮兘鏄漿涓烘湁絎﹀彿綾誨瀷錛屽彲浠ョ洿鎺ヨ繘琛屾瘮杈冦?/div>鏈緇堜唬鐮侊細(xì)<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; "><br />template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> IsSigned { <br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> value </span><span style="color: #000000; ">=</span><span style="color: #000000; "> T(</span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">) </span><span style="color: #000000; "><</span><span style="color: #000000; "> T(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">); <br />};<br /><br />template</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">bool</span><span style="color: #000000; ">></span><span style="color: #000000; "> </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> Assert {};<br />template</span><span style="color: #000000; "><></span><span style="color: #000000; "> </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> Assert</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">false</span><span style="color: #000000; ">></span><span style="color: #000000; ">;<br /><br />template</span><span style="color: #000000; "><</span><span style="color: #0000FF; ">int</span><span style="color: #000000; ">></span><span style="color: #000000; "> </span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> Type {};<br />typedef Type</span><span style="color: #000000; "><</span><span style="color: #000000; ">0</span><span style="color: #000000; ">></span><span style="color: #000000; "> TagNormal;<br />typedef Type</span><span style="color: #000000; "><</span><span style="color: #000000; ">1</span><span style="color: #000000; ">></span><span style="color: #000000; "> TagFirstArgIsSigned;<br />typedef Type</span><span style="color: #000000; "><</span><span style="color: #000000; ">2</span><span style="color: #000000; ">></span><span style="color: #000000; "> TagSecondArgIsSigned;<br /><br />template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2, typename T3</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> SafeIntCompare(T1 v1, T2 v2, T3, TagNormal)<br />{<br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v1  </span><span style="color: #000000; "><</span><span style="color: #000000; "> v2) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v1 </span><span style="color: #000000; ">==</span><span style="color: #000000; "> v2) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />}<br /><br />template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2, typename T3</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> SafeIntCompare(T1 v1, T2 v2, T3 v3, TagFirstArgIsSigned)<br />{<br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v1 </span><span style="color: #000000; "><</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> SafeIntCompare(T3(v1), T3(v2), v3, TagNormal());<br />}<br /><br />template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2, typename T3</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> SafeIntCompare(T1 v1, T2 v2, T3 v3, TagSecondArgIsSigned)<br />{<br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (v2 </span><span style="color: #000000; "><</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">) </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> SafeIntCompare(T3(v1), T3(v2), v3, TagNormal());<br />}<br /><br />template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2, typename T3</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> SafeIntCompare(T1 v1, T2 v2, T3 v3)<br />{<br />  typedef std::numeric_limits</span><span style="color: #000000; "><</span><span style="color: #000000; ">T1</span><span style="color: #000000; ">></span><span style="color: #000000; "> M1;<br />  typedef std::numeric_limits</span><span style="color: #000000; "><</span><span style="color: #000000; ">T2</span><span style="color: #000000; ">></span><span style="color: #000000; "> M2;<br />  typedef std::numeric_limits</span><span style="color: #000000; "><</span><span style="color: #000000; ">T3</span><span style="color: #000000; ">></span><span style="color: #000000; "> M3;<br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> is_arg_valid </span><span style="color: #000000; ">=</span><span style="color: #000000; "> M1::is_integer </span><span style="color: #000000; ">&</span><span style="color: #000000; "> M2::is_integer;<br />  Assert</span><span style="color: #000000; "><</span><span style="color: #000000; ">is_arg_valid</span><span style="color: #000000; ">></span><span style="color: #000000; ">();<br />  </span><span style="color: #0000FF; ">static</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> type_idx </span><span style="color: #000000; ">=</span><span style="color: #000000; "> M3::is_signed </span><span style="color: #000000; ">?</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; "> : (M1::is_signed </span><span style="color: #000000; ">+</span><span style="color: #000000; "> M2::is_signed </span><span style="color: #000000; ">*</span><span style="color: #000000; "> </span><span style="color: #000000; ">2</span><span style="color: #000000; ">) </span><span style="color: #000000; ">%</span><span style="color: #000000; "> </span><span style="color: #000000; ">3</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> SafeIntCompare(v1, v2, v3, Type</span><span style="color: #000000; "><</span><span style="color: #000000; ">type_idx</span><span style="color: #000000; ">></span><span style="color: #000000; ">());<br />}<br /><br /><br />template</span><span style="color: #000000; "><</span><span style="color: #000000; ">typename T1, typename T2</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> SafeIntCompare(T1 v1, T2 v2)<br />{<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> SafeIntCompare(v1, v2, T1(</span><span style="color: #000000; ">0</span><span style="color: #000000; ">) </span><span style="color: #000000; ">+</span><span style="color: #000000; "> T2(</span><span style="color: #000000; ">0</span><span style="color: #000000;">));<br />}<br /></span></div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/169554.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-03-30 20:16 <a href="http://www.shnenglu.com/flyinghearts/archive/2012/03/30/169554.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>闈㈣瘯棰樼簿瑙?鐩綍http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168270.htmlflyingheartsflyingheartsSun, 18 Mar 2012 14:24:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2012/03/18/168270.htmlhttp://www.shnenglu.com/flyinghearts/comments/168270.htmlhttp://www.shnenglu.com/flyinghearts/archive/2012/03/18/168270.html#Feedback0http://www.shnenglu.com/flyinghearts/comments/commentRss/168270.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/168270.html鐩?nbsp; 褰?/div>


 1  姹備簩鍙夋爲(wèi)涓浉璺濇渶榪滅殑涓や釜鑺傜偣涔嬮棿鐨勮窛紱?br /> 2  鍒ゆ柇浜屽弶鏍?wèi)鏄惁邈^琛′簩鍙夋爲(wèi)
 3  鎸囧畾浜屽弶鏍?wèi)锛尵l欏畾涓よ妭鐐規(guī)眰鍏舵渶榪戝叡鍚岀埗鑺傜偣
 4  浜屽弶鏍?wèi)鐨勻q垮害閬嶅巻銆侀愬眰鎵撳嵃浜屽弶鏍?wèi)鑺傜傄?guī)暟鎹佸彧鎵撳嵃鏌愬眰鑺傜偣鏁版嵁
 5  鍦ㄤ簩鍙夋爲(wèi)涓壘鍑哄拰錛堝彾瀛愬埌鏍硅妭鐐硅礬寰勪笂鐨勬墍鏈夎妭鐐圭殑鏁版嵁鍜岋級涓烘寚瀹氬肩殑鎵鏈夎礬寰勩?br /> 6  灝嗕簩鍙夋煡鎵炬爲(wèi)杞負(fù)鏈夊簭鐨勫弻閾捐〃
 7  姹備簩鍙夋爲(wèi)鐨勯暅鍍?br /> 8  浜屽弶鏍?wèi)鍓嶅簭銆佷腑搴忋佸悗搴忛亶鍘嗙殑闈為掑綊瀹炵幇
 9  姹備簩鍙夋爲(wèi)楂樺害鐨勯潪閫掑綊瀹炵幇
10  榪炴帴浜屽弶鏍?wèi)鍚屼竴灞備笂鐨勭粨鐐?/div>

 1 鍦ㄤ竴涓瓧絎︿覆涓壘鍒扮涓涓彧鍑虹幇涓嬈$殑瀛楃錛屽杈撳叆abac錛屽垯杈撳嚭b銆?br /> 2 杈撳嚭瀛楃涓茬殑鎵鏈夌粍鍚堬紝濡?abc"杈撳嚭a銆乥銆乧銆乤b銆乤c銆乥c銆乤bc銆?br /> 3 鏍規(guī)嵁鏉′歡鎵懼嚭涓や釜鏁般?br />   ①  鏁扮粍涓紝闄や簡涓や釜鏁板瓧鍑虹幇濂囨暟嬈″錛屽叾瀹冩暟瀛楅兘鍑虹幇鍋舵暟嬈★紝鎵懼嚭榪欎袱涓暟瀛楋細(xì)
   ②  闀垮害涓簄鐨勬暟緇勶紝鐢辨暟瀛?鍒皀緇勬垚錛屽叾涓暟瀛梐涓嶅嚭鐜幫紝鏁板瓧b鍑虹幇涓ゆ錛屽叾瀹冪殑鏁板瓧鎭板ソ鍑虹幇涓嬈°?br />       鍦ㄤ笉淇敼鍘熸暟緇勭殑鎯呭喌涓嬶紝鎵懼嚭鏁板瓧a鍜屾暟瀛梑銆?br /> 4 姹傛暟緇勶紙鎴栫幆鐘舵暟緇勶級鐨勬渶澶ц繛緇紙鎴栦笉榪炵畫錛夊瓙搴忓垪鍜屻?br />



]]>闈㈣瘯棰樼簿瑙d箣浜岋細(xì) 瀛楃涓層佹暟緇勶紙1錛?/title><link>http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Sun, 18 Mar 2012 13:28:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/168269.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/168269.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/168269.html</trackback:ping><description><![CDATA[     鎽樿: 闈㈣瘯棰樼簿瑙d箣浜岋細(xì) 瀛楃涓層佹暟緇勶紙1錛?  鏈瘒鏂囩珷鍙戣〃鍦ㄤ笅闈笁涓崥瀹腑錛屽鏋滃嚭鐜版帓鐗堥棶棰橈紝璇風(fēng)Щ姝ュ埌鍙︿竴涓崥瀹€?http://www.shnenglu.com/flyinghearts http://www.cnblogs.com/flyinghearts http://blog.csdn.net/flyinghearts   1   ...  <a href='http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/flyinghearts/aggbug/168269.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-03-18 21:28 <a href="http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>閬垮厤璁$畻榪囩▼涓嚭鐜版孩鍑虹殑涓涓妧宸?/title><link>http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168267.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Sun, 18 Mar 2012 13:16:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168267.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/168267.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168267.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/168267.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/168267.html</trackback:ping><description><![CDATA[<div> <p> </p> <p style="text-indent: 21pt;"><span style="font-family: 瀹嬩綋;">鍏堢湅涓閬撻潰璇曢錛?/span></p><p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman""><br /></span></p> <p style="text-indent:23.6pt;"><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">闀垮害涓?/span></strong><strong><span style="font-size:12.0pt">n</span></strong><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鐨勬暟緇勶紝鐢辨暟瀛?/span></strong><strong><span style="font-size:12.0pt">1</span></strong><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鍒?/span></strong><strong><span style="font-size:12.0pt">n</span></strong><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">緇勬垚錛屽叾涓暟瀛?/span></strong><strong><span style="font-size:12.0pt">a</span></strong><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">涓嶅嚭鐜幫紝鏁板瓧</span></strong><strong><span style="font-size:12.0pt">b</span></strong><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鍑虹幇涓ゆ錛屽叾瀹冪殑鏁板瓧鎭板ソ鍑虹幇涓嬈°傛庢牱閫氳繃鍙閬嶅巻涓嬈℃暟緇勶紝鎵懼嚭鏁板瓧</span></strong><strong><span style="font-size:12.0pt">a</span></strong><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鍜?/span></strong><strong><span style="font-size:12.0pt">b</span></strong><strong><span style="font-size:12.0pt;font-family: 瀹嬩綋;Times New Roman";Times New Roman"">銆?/span></strong></p> <p> </p> <p> </p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐢變簬鍙兘閬嶅巻涓嬈★紝鍦ㄩ亶鍘嗘暟緇?/span>arr<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏃訛紝綆楀嚭</span> a<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鍜?/span>b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勫樊鍊鹼紝浠ュ強</span>a<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍜?/span>b<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鐨勫鉤鏂瑰樊錛岄氳繃瑙f柟紼嬶紝鍗沖彲姹傚緱</span>a<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍜?/span>b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">銆傚叿浣撳仛娉曚負(fù)錛?/span></p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">璁撅細(xì)</span></p> <p><span><span>      </span>s1 = 1 + 2 + ... + n           (= n * (n + 1) / 2)</span></p> <p><span><span>      </span>s2 = arr[0] + arr[1] + ... + arr[n - 1]</span></p> <p><span>    </span></p> <p><span><span>      </span>r1 = 1 + 4 + ... + n^2          (= n * (n + 1) * (2 * n + 1) / 6)</span></p> <p><span><span>      </span>r2 = arr[0]^2 + arr[1]^2 + ... + arr[n - 1]^2</span></p> <p><span><span>      </span></span></p> <p><span>     c = a - b = s1 - s2</span></p> <p><span>     d = a^2 - b^2 = r1 - r2</span></p> <p> <span>   </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏄劇劧錛?/span> <span> a + b = (r1 - r2) / (s1 - s2) </span></p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏍規(guī)嵁</span>a+b<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鐨勫煎拰</span>a-b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勫鹼紝寰堝鏄撳氨鍙畻鍑?/span>a<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍜?/span>b<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">銆?/span></p> <p> </p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">綆楁硶铏界劧綆鍗曪紝浣嗗疄鐜拌搗鏉ワ紝鍗存湁涓涓緢澶ч棶棰橈細(xì)璁$畻</span> s1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">銆?/span>s2<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">銆?/span>r1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">銆?/span>r2<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">榪?/span>4<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">涓暟鏃訛紝璁$畻榪囩▼涓彲鑳藉嚭鐜版孩鍑猴紝閫犳垚緇撴灉涓嶅噯銆傜敱浜庢渶緇堢洰鐨勬槸涓轟簡璁$畻鍑?/span>c<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍜?/span>d<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛屼竴涓敼榪涚殑鏂規(guī)硶鏄細(xì)</span></p> <p><span> c = s1 - s2 = (1 - arr[0]) + (2 - arr[1]) + ... + (n - arr[n - 1])</span></p> <p><span> d = (1 - arr[0]^2) + (4 - arr[1]^2) + ... + (n^2 - arr[n - 1]^2)</span></p> <p><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣嗚繖鏍風(fēng)殑鍋氭硶錛屽茍涓嶈兘瑙e喅闂錛?/span>n<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">紼嶅井澶х偣錛岀収鏍峰瓨鍦ㄦ孩鍑洪棶棰樸?/span></p> <p> </p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">閭d箞鎬庢牱鎵嶈兘閬垮厤璁$畻婧㈠嚭鍛紵絳旀寰堢畝鍗曪紝<strong><span style="color:red">鐢ㄦā榪愮畻錛?/span></strong>姣忚繘琛屼竴嬈″姞鍑忚繍綆楁椂錛岄兘鍙栫粨鏋滀負(fù)鍘熺粨鏋滈櫎浠ヤ竴涓凍澶熷ぇ鐨勫父鏁?/span>M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勪綑鏁般傝繖鏍峰姞鍑忚繍綆椾腑錛屽氨涓嶄細(xì)鐜扮幇婧㈠嚭闂銆傛渶鍚庡啀鐢?/span> c % M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">銆?/span>d % M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛屾帹嫻嬪嚭</span>c<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">銆?/span>d<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勫叿浣撳箋傛瘮濡傝錛岃綆?/span>s2<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏀逛負(fù)璁$畻錛?/span></p> <p> <span>  s2 % M = ((((arr[0] % M) + arr[1]) % M + ...) % M + arr[n - 1]) %M</span></p> <p><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浠庤〃闈笂鐪嬶紝閲囩敤妯¤繍綆楀悗錛岃綆楅噺浼?xì)澧炲姞寰堝銆備絾瀹為檯涓婏紝鑻?/span>M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍙栧悎閫傜殑鍊兼椂錛岃綆楅噺騫朵笉浼?xì)澧炲姞锛佸Q?/span></p> <p> </p> <p style="text-indent:21.75pt"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍏堝洖欏句笅璁$畻鏈哄熀鏈煡璇嗭細(xì)涓や釜鍚?/span>N<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣嶏紙瀵勫瓨鍣ㄤ負(fù)</span>N<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣嶏級鐨勪簩榪涘埗鏃犵鍙鋒暣鏁?/span>a<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍜?/span>b<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鐩稿姞錛岃嫢緇撴灉婧㈠嚭浜嗭紝</span>CPU<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浼?xì)鎬庝箞澶勭悊錛熷綋鐒舵槸灝嗘孩鍑虹殑閭d竴浣嶅拷鐣ユ帀錛堝彲鑳借繕瑕佽緗笅婧㈠嚭鏍囧織錛夛紝寰楀埌鐨勭粨鏋滃疄闄呬笂鏄細(xì)</span>(a + b) mod 2^N<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">銆?strong><span style="color:red">鏃犵鍙鋒暟闂寸殑綆楁湳榪愮畻錛屾湰璐ㄤ笂灝辨槸妯¤繍綆?/span></strong>銆傜幇鍦ㄧ殑</span>CPU<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">閮?strong><span style="color:red">閲囩敤浜岃ˉ鏁版潵琛ㄧず璐熸暣鏁幫紝鏈川涓婁篃鏄繍鐢ㄦā榪愮畻</span></strong>錛堟暀縐戜功灝嗕簩琛ユ暟琛ㄧず鐨勮礋鏁存暟綆鍗曞畾涔変負(fù)錛氬姝f暣鏁板彇鍙嶅悗鍔?/span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛夛紝榪欎笌鏃犵鍙鋒暟闂寸殑榪愮畻鏄竴鑷寸殑錛屽湪瀹炵幇涓婏紝姣旂敤鍏跺畠鏂規(guī)硶錛堟瘮濡傝涓琛ユ暟錛夎〃紺鴻礋鏁存暟錛岃浼樼編鏄撳疄鐜般?/span></p> <p style="text-indent:21.75pt"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍦?/span>32<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣嶅鉤鍙頒笅錛?/span> <span>-x mod 2^32 = 2^32 – x (x > 0)</span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛?/span> </p> <p style="text-indent:21.75pt"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍥犺?/span>-1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勪簩榪涘埗琛ㄧず灝辨槸錛?/span>0xFFFFFFFF</p> <p> </p> <p style="text-indent:21.75pt"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浜嗚В浜嗚繖浜涳紝灝變笉浼?xì)濂囨?/span>C/C++<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏍囧噯鐨勮瀹氾細(xì)鏃犵鍙鋒暟闂寸殑榪愮畻鏄ā榪愮畻涓嶄細(xì)婧㈠嚭錛涙湁絎﹀彿鏁拌漿涓烘棤絎︽暟錛岄噰鐢ㄦā榪愮畻鍚庣殑鍊箋傦紙涓轟簡鍏煎娌¢噰鐢ㄤ簩琛ユ暟鐨勬満鍣紝鏃犵鍙鋒暟杞負(fù)鏈夌鍙鋒暟鏃訛紝鑻ユ棤絎﹀彿鏁扮殑鏁板艱秴鍑轟簡鏈夌鍙鋒暟鍙〃紺虹殑鑼冨洿錛岀粨鏋滄槸騫沖彴鐩稿叧鐨勩傦級</span></p> <p> </p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍥犺岋紝鍦ㄥ</span>32<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣?/span>CPU<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">騫沖彴錛屽彲浠ュ厛灝嗘湁絎﹀彿鏁拌漿涓烘棤絎﹀彿鏁幫紝鍐嶅彇</span>M = 2 ^32<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">銆傞渶瑕佺壒鍒敞鎰忕殑鏄紝搴旇閲囩敤澶氬皯浣嶇殑鏃犵鍙鋒暟淇濆瓨璁$畻涓敤鍒扮殑鏁板鹼紝濡備綍閬垮厤妯¤繍綆楀彲鑳藉甫鏉ョ殑闂錛?/span></p> <p> </p> <p><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">①銆鏃犵鍙鋒暟綾誨瀷鐨勯夋嫨錛?/span></p> <p style="margin-left:27.0pt; text-indent:-6.0pt;">a<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">銆?/span>b<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鐨勫彇鍊艱寖鍥翠負(fù)錛?/span>[1, n]<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛?/span> </p> <p style="text-indent:21.0pt;">c % M = (a - b) % M <span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勫彇鍊艱寖鍥翠負(fù)錛?/span>[1, n] (a > b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏃?/span>)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛?/span><span>   [M - n, M - 1] (a < b</span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏃?/span>)</p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">榪欎袱涓寖鍥翠笉鑳介噸鍙狅紝鑰屽洜</span> n < M - n <span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍗?/span> 2 * n < M</p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鑻?/span> M<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鍙?/span>2^32<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勮瘽錛屼笖</span><span> n < 2^31</span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛?/span> <span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鍙互閲囩敤</span>32<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣嶆棤絎﹀彿鏁拌〃紺?/span>c<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勫箋?/span></p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏍規(guī)嵁</span>c % M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍊煎湪鍝竴涓寖鍥達紝鍙互紜畾</span>a > b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">榪樻槸</span>a < b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛?/span></p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐢變簬榪愮畻榪囩▼涓兘鏄噰鐢ㄦ棤絎﹀彿鏁拌綆楋紝褰?/span> a < b<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏃訛紝蹇呴』榪涜濡備笅璋冩暣錛?/span></p> <p><span>        c % M </span><span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">璋冩暣涓?/span> (-c) % M</p> <p><span>        d % M </span><span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">璋冩暣涓?/span> (-d) % M</p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">榪欐牱鎵嶈兘淇濊瘉緇撴灉鐨勬紜с?/span></p> <p> </p> <p><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">②</span> <span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鐢ㄥ叕寮忚綆楁墍鏈夋暟瀛楃殑鍜屻佸鉤鏂瑰拰鏃訛紝鍙兘鍑虹幇鐨勯棶棰橈細(xì)</span></p> <p><span>   </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">妯¤繍綆楁弧瓚籌細(xì)</span><span> (a <strong>*</strong> b) % M  = ((a % M) <strong>*</strong> (b % M)) % M</span></p> <p><span>     </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣?strong>涓嶆弧瓚?/strong>錛?/span><span> (a<strong> /</strong> b) % M  = ((a % M) <strong>/</strong> (b % M)) % M</span></p> <p><span>   </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍦ㄨ綆?/span> (n * (n + 1) / 2) % M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鏃訛紝</span> <span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">涓嶈兘鍐欐垚錛?/span></p> <p> <span>     s = ((n * (n + 1)) % M / 2) % M</span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛?/span></p> <p><span>   </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鑰屽簲璇ュ啓鎴愶細(xì)</span></p> <p><span>     if  (n % 2 == 0)   s = ((n / 2) * (n + 1)) % M</span></p> <p> <span>    else             s = (((n + 1) / 2) * n) % M</span></p> <p><span>   </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鎴栬咃細(xì)</span><span>s = (INT((n + 1) / 2) * (n + (n + 1) % 2)) % M </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">錛堝叾涓?/span>INT(x)<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">涓哄彇灝忔暟</span>x<span style="font-family: 瀹嬩綋;Times New Roman";Times New Roman"">鐨勬暣鏁伴儴浠斤級銆?/span></p> <p> </p> <p><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">瀹屾暣浠g爜錛?/span></p> <p style="text-align: left;" align="left"> </p><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">climits</span><span style="color: #000000; ">></span><span style="color: #000000; "><br />#include </span><span style="color: #000000; "><</span><span style="color: #000000; ">cassert</span><span style="color: #000000; ">></span><span style="color: #000000; "><br /><br /></span><span style="color: #0000FF; ">#define</span><span style="color: #000000; "> SMALL_ARRAY 0</span><span style="color: #000000; "><br /><br /></span><span style="color: #0000FF; ">struct</span><span style="color: #000000; "> Pair {<br />  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> zero;<br />  </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> twice;<br />};<br /><br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">32浣岰PU騫沖彴錛岄暱搴涓瀹氬皬浜?^16嬈℃柟鏃訛紝琛ㄧず涓涓暟鐨勫鉤鏂瑰鹼紝鍙敤32浣嶆棤絎﹀彿鏁扮被鍨嬶紝鏁堢巼寰堥珮銆?br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">闀垮害n鑻ュ湪[2^16, 2^31]鍖洪棿錛屽氨蹇呴』鐢ㄥ埌64浣嶆棤絎﹀彿鏁扮被鍨嬶紝鏁堢巼杈冮珮銆?br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">闀垮害n鑻ュ湪[2^31, 2^32)鏃訛紝琛ㄧず 鎵鏈夋暟鐨勫拰sum錛屽氨蹇呴』鏀圭敤64浣嶆棤絎﹀彿鏁扮被鍨嬶紝鏁堢巼涓嶉珮銆?nbsp; </span><span style="color: #008000; "><br /></span><span style="color: #000000; ">Pair find_number(</span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> arr[], unsigned len)<br />{<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned bits </span><span style="color: #000000; ">=</span><span style="color: #000000; "> CHAR_BIT </span><span style="color: #000000; ">*</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">sizeof</span><span style="color: #000000; ">(unsigned);<br /></span><span style="color: #0000FF; ">#if</span><span style="color: #000000; "> SMALL_ARRAY</span><span style="color: #000000; "><br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned max_len </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">1u</span><span style="color: #000000; "> </span><span style="color: #000000; "><<</span><span style="color: #000000; "> (bits </span><span style="color: #000000; ">/</span><span style="color: #000000; "> </span><span style="color: #000000; ">2u</span><span style="color: #000000; ">);<br />  typedef unsigned </span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">uint</span><span style="color: #000000; ">;<br /></span><span style="color: #0000FF; ">#else</span><span style="color: #000000; "><br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned max_len </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">1u</span><span style="color: #000000; "> </span><span style="color: #000000; "><<</span><span style="color: #000000; "> (bits </span><span style="color: #000000; ">-</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">);<br />  typedef unsigned </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">long</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">uint</span><span style="color: #000000; ">;<br /></span><span style="color: #0000FF; ">#endif</span><span style="color: #000000; "><br /><br />  assert(arr </span><span style="color: #000000; ">&&</span><span style="color: #000000; "> len </span><span style="color: #000000; ">>=</span><span style="color: #000000; "> </span><span style="color: #000000; ">2</span><span style="color: #000000; "> </span><span style="color: #000000; ">&&</span><span style="color: #000000; "> len </span><span style="color: #000000; "><</span><span style="color: #000000; "> max_len);<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned</span><span style="color: #000000; ">*</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> data </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned</span><span style="color: #000000; ">*</span><span style="color: #000000; ">)arr;<br />  unsigned sum </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">uint</span><span style="color: #000000; "> square_sum </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">for</span><span style="color: #000000; "> (unsigned i </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">; i </span><span style="color: #000000; "><</span><span style="color: #000000; "> len; </span><span style="color: #000000; ">++</span><span style="color: #000000; ">i)  {<br />    </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned value </span><span style="color: #000000; ">=</span><span style="color: #000000; "> data[i];<br />    sum </span><span style="color: #000000; ">+=</span><span style="color: #000000; "> value;<br />    square_sum </span><span style="color: #000000; ">+=</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">uint</span><span style="color: #000000; ">)value </span><span style="color: #000000; ">*</span><span style="color: #000000; "> value;     </span><span style="color: #008000; ">//</span><span style="color: #008000; ">娉ㄦ剰涓や釜鏁扮殑涔樼Н鏄惁浼?xì)婧㈠?nbsp; </span><span style="color: #008000; "><br /></span><span style="color: #000000; ">  }<br />  <br />  </span><span style="color: #008000; ">//</span><span style="color: #008000; ">1 + 2 + 3 + <img src="http://www.shnenglu.com/Images/dot.gif" alt="" /> + len = len * (len + 1) / 2</span><span style="color: #008000; "><br /></span><span style="color: #000000; ">  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">uint</span><span style="color: #000000; "> sum_all </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (len </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">) </span><span style="color: #000000; ">/</span><span style="color: #000000; "> </span><span style="color: #000000; ">2u</span><span style="color: #000000; "> </span><span style="color: #000000; ">*</span><span style="color: #000000; "> (</span><span style="color: #0000FF; ">uint</span><span style="color: #000000; ">)(len </span><span style="color: #000000; ">+</span><span style="color: #000000; "> (len </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">) </span><span style="color: #000000; ">%</span><span style="color: #000000; "> </span><span style="color: #000000; ">2u</span><span style="color: #000000; ">);<br />  <br />  </span><span style="color: #008000; ">//</span><span style="color: #008000; ">1^2 + 2^2 + 3^2 + <img src="http://www.shnenglu.com/Images/dot.gif" alt="" /> + len^2 = len * (len + 1) * (2 * len + 1) / 6</span><span style="color: #008000; "><br /></span><span style="color: #000000; ">  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned len2 </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">2u</span><span style="color: #000000; "> </span><span style="color: #000000; ">*</span><span style="color: #000000; "> len </span><span style="color: #000000; ">+</span><span style="color: #000000; "> </span><span style="color: #000000; ">1</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">uint</span><span style="color: #000000; "> square_sum_all </span><span style="color: #000000; ">=</span><span style="color: #000000; "> len2 </span><span style="color: #000000; ">%</span><span style="color: #000000; "> </span><span style="color: #000000; ">3u</span><span style="color: #000000; "> </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; "> </span><span style="color: #000000; ">?</span><span style="color: #000000; "> len2 </span><span style="color: #000000; ">/</span><span style="color: #000000; "> </span><span style="color: #000000; ">3u</span><span style="color: #000000; "> </span><span style="color: #000000; ">*</span><span style="color: #000000; "> sum_all : sum_all </span><span style="color: #000000; ">/</span><span style="color: #000000; "> </span><span style="color: #000000; ">3u</span><span style="color: #000000; "> </span><span style="color: #000000; ">*</span><span style="color: #000000; "> len2;<br />  <br />  unsigned difference </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (unsigned)sum_all </span><span style="color: #000000; ">-</span><span style="color: #000000; "> sum;<br />  </span><span style="color: #0000FF; ">uint</span><span style="color: #000000; "> square_difference </span><span style="color: #000000; ">=</span><span style="color: #000000; "> square_sum_all </span><span style="color: #000000; ">-</span><span style="color: #000000; "> square_sum;<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> </span><span style="color: #0000FF; ">bool</span><span style="color: #000000; "> is_negative </span><span style="color: #000000; ">=</span><span style="color: #000000; "> difference </span><span style="color: #000000; ">></span><span style="color: #000000; "> INT_MAX;<br /><br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (is_negative) {<br />    difference </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">difference;<br />    square_difference </span><span style="color: #000000; ">=</span><span style="color: #000000; "> </span><span style="color: #000000; ">-</span><span style="color: #000000; ">square_difference;<br />  } <br />   <br />  assert(difference </span><span style="color: #000000; ">!=</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; "> </span><span style="color: #000000; ">&&</span><span style="color: #000000; "> square_difference </span><span style="color: #000000; ">%</span><span style="color: #000000; "> difference </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">);<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned sum_two </span><span style="color: #000000; ">=</span><span style="color: #000000; "> square_difference </span><span style="color: #000000; ">/</span><span style="color: #000000; "> difference;<br />  <br />  assert((sum_two </span><span style="color: #000000; ">+</span><span style="color: #000000; "> difference) </span><span style="color: #000000; ">%</span><span style="color: #000000; "> </span><span style="color: #000000; ">2u</span><span style="color: #000000; "> </span><span style="color: #000000; ">==</span><span style="color: #000000; "> </span><span style="color: #000000; ">0</span><span style="color: #000000; ">);<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned larger  </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (sum_two </span><span style="color: #000000; ">+</span><span style="color: #000000; "> difference) </span><span style="color: #000000; ">/</span><span style="color: #000000; "> </span><span style="color: #000000; ">2u</span><span style="color: #000000; ">;<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> unsigned smaller </span><span style="color: #000000; ">=</span><span style="color: #000000; "> (sum_two </span><span style="color: #000000; ">-</span><span style="color: #000000; "> difference) </span><span style="color: #000000; ">/</span><span style="color: #000000; "> </span><span style="color: #000000; ">2u</span><span style="color: #000000; ">;<br />  <br />  </span><span style="color: #0000FF; ">if</span><span style="color: #000000; "> (is_negative) {<br />    </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> Pair result </span><span style="color: #000000; ">=</span><span style="color: #000000; "> { smaller, larger};<br />    </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> result;<br />  }<br />  </span><span style="color: #0000FF; ">const</span><span style="color: #000000; "> Pair result </span><span style="color: #000000; ">=</span><span style="color: #000000; "> { larger, smaller};<br />  </span><span style="color: #0000FF; ">return</span><span style="color: #000000; "> result;<br />}<br /><br /><br /></span><span style="color: #0000FF; ">int</span><span style="color: #000000; "> main()<br />{<br /><br />}<br /><br /><br /></span></div></div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/168267.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-03-18 21:16 <a href="http://www.shnenglu.com/flyinghearts/archive/2012/03/18/168267.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title> Fibonacci鏁拌綆椾腑鐨勪袱涓濈淮鐩茬偣鍙婂叾鎵╁睍鏁板垪鐨勯氱敤楂樻晥瑙f硶http://www.shnenglu.com/flyinghearts/archive/2012/02/28/166717.htmlflyingheartsflyingheartsTue, 28 Feb 2012 14:14:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2012/02/28/166717.htmlhttp://www.shnenglu.com/flyinghearts/comments/166717.htmlhttp://www.shnenglu.com/flyinghearts/archive/2012/02/28/166717.html#Feedback11http://www.shnenglu.com/flyinghearts/comments/commentRss/166717.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/166717.html闃呰鍏ㄦ枃

]]>
闈㈣瘯棰樼簿瑙d箣涓錛?浜屽弶鏍?/title><link>http://www.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Tue, 28 Feb 2012 12:54:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/166713.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/166713.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/166713.html</trackback:ping><description><![CDATA[     鎽樿: 闈㈣瘯棰樼簿瑙d箣涓錛?浜屽弶鏍?  鏈瘒鏂囩珷鍙戣〃鍦ㄤ笅闈笁涓崥瀹腑錛屽鏋滃嚭鐜版帓鐗堥棶棰橈紝璇風(fēng)Щ姝ュ埌鍙︿竴涓崥瀹€?http://www.shnenglu.com/flyinghearts http://www.cnblogs.com/flyinghearts http://blog.csdn.net/flyinghearts   1     姹備簩鍙夋爲(wèi)涓浉...  <a href='http://www.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/flyinghearts/aggbug/166713.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-02-28 20:54 <a href="http://www.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍠濇苯姘撮棶棰?/title><link>http://www.shnenglu.com/flyinghearts/archive/2011/09/23/156635.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Fri, 23 Sep 2011 11:45:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2011/09/23/156635.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/156635.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2011/09/23/156635.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/156635.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/156635.html</trackback:ping><description><![CDATA[<div> <p style="text-align: center; text-indent: 23.6pt;" align="center"><strong><span style="font-size: 12pt; font-family: 瀹嬩綋;">鍠濇苯姘撮棶棰?/span></strong></p> <p style="text-align: center; text-indent: 23.6pt;" align="center"><strong><span style="font-size: 12pt;"><span>                                                  </span></span></strong><span style="font-size: 12pt;">by flyinghearts</span></p> <p style="text-indent: 23.6pt;"><strong> </strong></p> <p style="text-indent: 23.6pt;"><strong><span style="font-size: 12pt; font-family: 瀹嬩綋;">鏈?/span></strong><strong><span style="font-size: 12pt;">1000</span></strong><strong><span style="font-size: 12pt; font-family: 瀹嬩綋;">鐡舵苯姘達紝鍠濆畬鍚庢瘡</span></strong><strong><span style="font-size: 12pt;">3</span></strong><strong><span style="font-size: 12pt; font-family: 瀹嬩綋;">涓┖鐡惰兘鎹?/span></strong><strong><span style="font-size: 12pt;">1</span></strong><strong><span style="font-size: 12pt; font-family: 瀹嬩綋;">鐡舵苯姘達紝闂渶鍚庢渶澶氬彲浠ュ枬鍑犵摱姹芥按錛屾鏃跺墿浣欏嚑涓┖鐡訛紵</span></strong></p> <p> </p> <p> </p> <p style="text-indent: 20.65pt;"><strong><span style="font-family: 瀹嬩綋;">涓嶅Θ鍋囪錛屽叡鏈?/span>n</strong><strong><span style="font-family: 瀹嬩綋;">鐡舵苯姘達紝姣?/span>a</strong><strong><span style="font-family: 瀹嬩綋;">涓┖鐡惰兘鎹?/span>b</strong><strong><span style="font-family: 瀹嬩綋;">鐡舵苯姘達紙</span>a > b</strong><strong><span style="font-family: 瀹嬩綋;">錛夈?/span></strong><span style="font-family: 瀹嬩綋;">鍒氬紑濮嬫湁</span>n<span style="font-family: 瀹嬩綋;">鐡舵苯姘達紝鍠濆畬鍚庡氨鏈?/span>n<span style="font-family: 瀹嬩綋;">涓┖鐡訛紝澶氬枬鐨勬苯姘存槸闈犵┖鐡舵崲鏉ョ殑錛?strong><span style="color: blue;">姣忚繘琛屼竴嬈$┖鐡舵崲姹芥按錛屽氨鑳藉鍠?/span></strong></span><strong><span style="color: blue;">b</span></strong><strong><span style="font-family: 瀹嬩綋; color: blue;">鐡舵苯姘淬佺┖鐡舵暟鐩氨鍑忓皯浜?/span><span style="color: blue;">a-b</span></strong><strong><span style="font-family: 瀹嬩綋; color: blue;">涓?/span></strong><span style="font-family: 瀹嬩綋;">錛?/span>a<span style="font-family: 瀹嬩綋;">涓┖鐡舵崲浜?/span>b<span style="font-family: 瀹嬩綋;">鐡舵苯姘達紝鍠濆畬鍚庡緱鍒?/span>b<span style="font-family: 瀹嬩綋;">涓┖鐡訛級銆?/span></p> <p> </p> <p style="text-indent: 10.5pt;">(<span style="font-family: 瀹嬩綋;">涓嬮潰<strong>鐢?/strong></span><strong> [x] </strong><strong><span style="font-family: 瀹嬩綋;">琛ㄧず</span>x</strong><strong><span style="font-family: 瀹嬩綋;">鐨勬暣鏁伴儴鍒?/span></strong>)</p> <p><strong><span style="color: #993300;">1 </span></strong><strong><span style="font-family: 瀹嬩綋; color: #993300;">濡傛灉鍏佽浠庡埆澶勶紙鑰佹澘鎴栧叾浠栭【瀹㈠錛夊熺┖鐡訛紙褰撶劧錛屾湁鍊熸湁榪橈級</span></strong></p> <p style="text-indent: 10.55pt;"><strong><span style="font-family: 瀹嬩綋; color: blue;">絀虹摱鎹㈡苯姘存鏁幫細(xì)</span><span style="color: blue;">   [n / (a - b)]</span></strong></p> <p style="text-indent: 10.55pt;"><strong><span style="font-family: 瀹嬩綋; color: blue;">鏈鍚庡墿浣欑┖鐡訛細(xì)</span><span style="color: blue;">     n % (a - b)</span></strong></p> <p style="text-indent: 10.55pt;"><strong><span style="font-family: 瀹嬩綋; color: blue;">鎬誨叡鍙互鍠濆埌姹芥按錛?/span><span style="color: blue;"> n + [n / (a - b)] * b</span></strong></p> <p> </p> <p><strong><span style="color: #993300;">2 </span></strong><strong><span style="font-family: 瀹嬩綋; color: #993300;">涓嶅厑璁稿熺┖鐡?/span></strong></p> <p> <span style="font-family: 瀹嬩綋;">絀虹摱鎹㈡苯姘磋繃紼嬩腑錛?strong><span style="color: blue;">涓浣嗙┖鐡舵暟灝忎簬</span></strong></span><strong><span style="color: blue;">a</span></strong><strong><span style="font-family: 瀹嬩綋; color: blue;">錛屽垯鍋滄浜ゆ崲銆?/span></strong></p> <p> <span style="font-family: 瀹嬩綋;">瀵?/span> n < a<span style="font-family: 瀹嬩綋;">錛屾樉鐒訛紝絀虹摱鎹㈡苯姘存鏁頒負(fù)</span>0<span style="font-family: 瀹嬩綋;">錛屾誨叡鍙互鍠濆埌姹芥按</span>n<span style="font-family: 瀹嬩綋;">鐡訛紝鏈鍚庡墿浣欑┖鐡?/span>n<span style="font-family: 瀹嬩綋;">涓?/span></p> <p> <span style="font-family: 瀹嬩綋;">瀵?/span> n >= a<span style="font-family: 瀹嬩綋;">錛氾紙涓嬮潰鎻愪緵涓夌瑙f硶錛?/span></p> <p>  <span style="font-family: 瀹嬩綋;">瑙f硶涓</span><span>    </span><span style="font-family: 瀹嬩綋;">絀虹摱鎹㈡苯姘存鏁?/span>k<span style="font-family: 瀹嬩綋;">絳変簬婊¤凍</span>n – (a-b)*t < a<span style="font-family: 瀹嬩綋;">鐨勬渶灝忛潪璐熸暣鏁?/span>t:</p> <p><span><span>        </span>      t > (n-a)/(a-b)</span><span style="font-family: 瀹嬩綋;">錛屾渶灝忕殑</span>t<span style="font-family: 瀹嬩綋;">涓?/span> [(n-a)/(a-b)] + 1 = [(n-b)/(a-b)]</p> <p><span><span>            </span>  </span><span style="font-family: 瀹嬩綋;">鍓╀綑鐨勭┖鐡舵暟錛?/span>n – (a-b)*t </p> <p style="text-indent: 5cm;">= n – (a-b)*([(n-b)/(a-b)]) </p> <p><span><span>         </span>                  = b + (n-b) - (a-b)*([(n-b)/(a-b)])</span></p> <p style="text-indent: 5cm;">= b + (n-b)%(a-b)</p> <p style="text-indent: 136.5pt;"> </p> <p style="margin-left: 68.25pt; text-indent: -52.5pt;"><span style="font-family: 瀹嬩綋;">瑙f硶浜?/span> <span>  </span><span style="font-family: 瀹嬩綋;">鍏堥鐣?/span>a<span style="font-family: 瀹嬩綋;">涓┖鐡訛紝灝嗗墿浣欑殑</span>n-a<span style="font-family: 瀹嬩綋;">涓┖鐡惰繘琛屾崲姹芥按錛屾崲鐨勮繃紼嬩腑錛岃嫢絀虹摱涓嶅</span>a<span style="font-family: 瀹嬩綋;">涓紝鍒欎粠棰勭暀鐨?/span>a<span style="font-family: 瀹嬩綋;">涓┖鐡朵腑“鍊?#8221;錛屽洜鑰岋紝</span></p> <p style="margin-left: 57.75pt; text-indent: 10.5pt;"><span style="font-family: 瀹嬩綋;">絀虹摱鎹㈡苯姘存鏁幫細(xì)</span>[(n-a)/(a-b)] + 1 = [(n-b)/(a-b)]<span style="font-family: 瀹嬩綋;">錛堥鐣欑殑</span>a<span style="font-family: 瀹嬩綋;">涓┖鐡朵篃鑳芥崲涓嬈★級</span></p> <p style="text-indent: 68.25pt;"><span style="font-family: 瀹嬩綋;">鏈鍚庡墿浣欑┖鐡訛細(xì)</span> (n-b) % (a-b) + b<span style="font-family: 瀹嬩綋;">錛堥鐣欑殑</span>a<span style="font-family: 瀹嬩綋;">涓┖鐡舵崲寰?/span>b<span style="font-family: 瀹嬩綋;">鐡舵苯姘達級</span></p> <p style="text-indent: 78.75pt;"> </p> <p style="margin-left: 63pt; text-indent: -47.25pt;"><span style="font-family: 瀹嬩綋;">瑙f硶涓?/span><span>   </span><span style="font-family: 瀹嬩綋;">鏈鍚庝竴嬈$┖鐡舵崲姹芥按寰楀埌鐨?/span>b<span style="font-family: 瀹嬩綋;">鐡舵苯姘達紝鍠濆畬鍚庡緱鍒?/span>b<span style="font-family: 瀹嬩綋;">涓┖鐡訛紝鍥犺屾渶鍚庡墿浣欑┖鐡舵暟蹇呯劧澶т簬</span>b<span style="font-family: 瀹嬩綋;">涓紝鍏堥鐣?/span>b<span style="font-family: 瀹嬩綋;">涓┖鐡訛紝灝嗗墿浣欑殑</span>n-b<span style="font-family: 瀹嬩綋;">涓┖鐡惰繘琛屾崲姹芥按錛岃嫢絀虹摱涓嶅</span>a<span style="font-family: 瀹嬩綋;">涓紝鍒欎粠棰勭暀鐨?/span>b<span style="font-family: 瀹嬩綋;">涓┖鐡朵腑“鍊?#8221;錛堢敱浜庤兘榪涜絀虹摱鎹㈡苯姘達紝絀虹摱鏁?/span>>= a – b<span style="font-family: 瀹嬩綋;">錛屽洜鑰?#8220;鍊?#8221;瀹屽悗錛屽彲浠ヤ繚璇佺┖鐡舵暟澶х瓑浜?/span>a<span style="font-family: 瀹嬩綋;">錛夛紝</span></p> <p style="text-indent: 10.5pt;"><span>           </span><span style="font-family: 瀹嬩綋;">絀虹摱鎹㈡苯姘存鏁幫細(xì)</span>[(n-b)/(a-b)]<span style="font-family: 瀹嬩綋;">錛?/span> </p> <p style="text-indent: 68.25pt;"><span style="font-family: 瀹嬩綋;">鏈緇堝墿浣欑┖鐡舵暟錛?/span>b + (n-b) % (a-b)</p> <p> </p> <p><span style="font-family: 瀹嬩綋;">錛堝瑙f硶涓夛紝</span>n>=b<span style="font-family: 瀹嬩綋;">鏃剁粨璁烘垚绔嬶紝瀵硅В娉曚竴銆佷簩錛屽彲浠ラ獙璇?/span>n >=b<span style="font-family: 瀹嬩綋;">鏃訛紝緇撹涔熸垚绔嬶級</span></p> <p> </p> <p><span style="font-family: 瀹嬩綋;">鍥犺岋紝<strong><span style="color: blue;">瀵?/span></strong></span><strong><span style="color: blue;"> n >= b </span></strong></p> <p style="text-indent: 10.55pt;"><strong><span style="font-family: 瀹嬩綋; color: blue;">絀虹摱鎹㈡苯姘存鏁幫細(xì)</span><span style="color: blue;">   [(n-b)/(a-b)] </span></strong></p> <p style="text-indent: 10.55pt;"><strong><span style="font-family: 瀹嬩綋; color: blue;">鏈鍚庡墿浣欑┖鐡訛細(xì)</span><span style="color: blue;">     b + (n-b) % (a-b)</span></strong></p> <p style="text-indent: 10.55pt;"><strong><span style="font-family: 瀹嬩綋; color: blue;">鎬誨叡鍙互鍠濆埌姹芥按錛?/span><span style="color: blue;"> n + [(n-b)/(a-b)] * b</span></strong></p> <p> </p> <p><span style="font-family: 瀹嬩綋;">瀵瑰師棰橈細(xì)</span></p> <p><span> n = 1000</span><span style="font-family: 瀹嬩綋;">錛?/span>a = 3, b = 1<span style="font-family: 瀹嬩綋;">錛?/span> a – b = 2</p> <p> <strong><span style="font-family: 瀹嬩綋;">鑻ュ厑璁稿熺┖鐡?/span> <span>   </span></strong></p> <p style="text-indent: 25.7pt;"><span style="font-family: 瀹嬩綋;">鍙互鍠濆埌姹芥按錛?/span> 1000 + 1000 / 2 = 1500</p> <p style="text-indent: 25.7pt;"><span style="font-family: 瀹嬩綋;">鍓╀綑絀虹摱錛?/span>1000 % 2 = 0</p> <p style="text-indent: 25.7pt;"> </p> <p style="text-indent: 10.35pt;"><strong><span style="font-family: 瀹嬩綋;">鑻ヤ笉鍏佽鍊熺┖鐡?/span> </strong></p> <p style="text-indent: 25.7pt;"><span style="font-family: 瀹嬩綋;">鍙互鍠濆埌姹芥按錛?/span> 1000 + (1000 - 1) / 2 = 1499<span style="font-family: 瀹嬩綋;">錛?/span> </p> <p style="text-indent: 25.7pt;"><span style="font-family: 瀹嬩綋;">鍓╀綑絀虹摱錛?/span><span>     1 + (1000 - 1) % 2 = 2</span></p> <p> </p> </div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/156635.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2011-09-23 19:45 <a href="http://www.shnenglu.com/flyinghearts/archive/2011/09/23/156635.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓夊浗蹇?鍓ф湰淇敼鍣?1.1http://www.shnenglu.com/flyinghearts/archive/2011/08/07/152739.htmlflyingheartsflyingheartsSun, 07 Aug 2011 15:24:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2011/08/07/152739.htmlhttp://www.shnenglu.com/flyinghearts/comments/152739.htmlhttp://www.shnenglu.com/flyinghearts/archive/2011/08/07/152739.html#Feedback1http://www.shnenglu.com/flyinghearts/comments/commentRss/152739.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/152739.html  緇欎互鍓嶅啓鐨勫墽鏈慨鏀瑰櫒錛屽姞浜嗕釜鐣岄潰錛屾湰鎯崇敤wtl錛屼絾鏄唬鐮佷腑鐢ㄥ埌涓嶅皯“鍒濆鍖栧垪琛?#8221;絳塩++11鏂扮壒鎬э紝鍙ソ璁¬C2010闈犺竟绔欎簡銆傚mingw錛屽ソ鐢ㄧ殑gui搴撹繕鐪熸病鏈夛紝鎯蟲兂灝卞崄鍑犱釜娑堟伅錛屽共鑴嗙洿鎺ヨ皟鐢╳indows api寰椾簡銆?br />


]]>
瀵圭幆鐘舵暟緇勬眰榪炵畫瀛愭暟緇勭殑鏈澶у拰http://www.shnenglu.com/flyinghearts/archive/2011/07/20/151513.htmlflyingheartsflyingheartsWed, 20 Jul 2011 15:49:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2011/07/20/151513.htmlhttp://www.shnenglu.com/flyinghearts/comments/151513.htmlhttp://www.shnenglu.com/flyinghearts/archive/2011/07/20/151513.html#Feedback2http://www.shnenglu.com/flyinghearts/comments/commentRss/151513.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/151513.html

 

鎬濊礬錛氱敱浜庢暟緇勫厓绱犳誨拰鏄浐瀹氬鹼紝鍥犺岃法澶淬佸熬鐨勮繛緇瓙鏁扮粍鍜屾渶澶э紝絳変環(huán)浜庢眰 涓棿閭f鍜屾渶灝忋傚洜姝わ紝闂杞負(fù)璁$畻 榪炵畫瀛愭暟緇勭殑鏈澶у拰 涓?榪炵畫瀛愭暟緇勭殑鏈灝忓拰


import std.algorithm;

 

int ring_max_continue_sum(in int[] src)

{

 int min_sum = src[0], cur_min_sum = min_sum;

 int max_sum = src[0], cur_max_sum = max_sum;

 int total_sum = src[0];

 

 foreach (value; src[1 .. $]) {

    cur_min_sum = min(value, cur_min_sum + value);

    min_sum = min(min_sum, cur_min_sum);

  

    cur_max_sum = max(value, cur_max_sum + value);

    max_sum = max(max_sum, cur_max_sum);

  

    total_sum += value;

 }

 return max(max_sum, total_sum - min_sum);

}

 

unittest {

 auto ta = [3, -2, 3];

 auto tb = [3, 4, -2, 3, -7, 1, -3, 8];

 assert(ta.ring_max_continue_sum == 6);

 assert(tb.ring_max_continue_sum == 16);

}

 

void main()

{

}

 



]]>
鏈鐭憳瑕佺殑鐢熸垚錛堣ˉ鍏咃級http://www.shnenglu.com/flyinghearts/archive/2011/07/20/151511.htmlflyingheartsflyingheartsWed, 20 Jul 2011 15:39:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2011/07/20/151511.htmlhttp://www.shnenglu.com/flyinghearts/comments/151511.htmlhttp://www.shnenglu.com/flyinghearts/archive/2011/07/20/151511.html#Feedback0http://www.shnenglu.com/flyinghearts/comments/commentRss/151511.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/151511.html闃呰鍏ㄦ枃

]]>
Fibonacci鏁板垪鐨勪袱縐峅(lgn)瑙f硶http://www.shnenglu.com/flyinghearts/archive/2011/07/20/151510.htmlflyingheartsflyingheartsWed, 20 Jul 2011 15:30:00 GMThttp://www.shnenglu.com/flyinghearts/archive/2011/07/20/151510.htmlhttp://www.shnenglu.com/flyinghearts/comments/151510.htmlhttp://www.shnenglu.com/flyinghearts/archive/2011/07/20/151510.html#Feedback0http://www.shnenglu.com/flyinghearts/comments/commentRss/151510.htmlhttp://www.shnenglu.com/flyinghearts/services/trackbacks/151510.html 

import std.stdio : writef;

 

uint fib_matrix(uint num) // 鐭╅樀娉曟眰fibonacci鏁?/span>

{

 if (num <= 1) return num;

 --num;

 uint ret = 1, next = 1;

 for (uint a = 1, b = 0; num != 0; num >>= 1) {

    if (num & 1) {

       auto tmp = next;

       next = (a + b) * next + a * ret;

       ret = a * tmp + b * ret;

      }

      auto tmp = a;

      a = a * (a + 2 * b);

      b = b * b + tmp * tmp;

 }

 return ret;

}

 

uint fib(uint num)

{

 if (num <= 1) return num;

 

 uint left_most_one = num; //灝忕瓑浜巒um鐨勬渶澶?鐨刱嬈″箓

 for (uint value = num; value &= (value - 1); ) left_most_one = value;

 

 uint ret = 1, next = 1;

 while (left_most_one >>= 1) {

    if (num & left_most_one) {

       auto tmp = ret;

      ret = ret * ret + next * next;

      next = (tmp * 2 + next) * next;

    } else {

       auto tmp = ret;

      ret = (next * 2 - ret) * ret;

      next = tmp * tmp + next * next;

    }

 }

 return ret;

}

 

uint fib_basic(uint num)

{

 if (num <= 1) return num;

 uint prev = 0, current = 1;

 for (uint i = 2; i <= num; ++i) {

    auto tmp = prev;

    prev = current;

    current += tmp;

 }

 return current;

}

 

unittest {

 foreach (i; 0 .. 48) {

    auto a = fib_basic(i), b = fib_matrix(i), c = fib(i);

    if (a != b || a != c)

      writef("%s %s %s %s\n", i, a, b, c);

 } 

}

 

void main()

{

 

}



]]>
VC 2010銆error D8027錛屾棤娉曟墽琛宑1xx.dll鐨勮В鍐蟲柟娉?/title><link>http://www.shnenglu.com/flyinghearts/archive/2011/07/19/151417.html</link><dc:creator>flyinghearts</dc:creator><author>flyinghearts</author><pubDate>Tue, 19 Jul 2011 14:07:00 GMT</pubDate><guid>http://www.shnenglu.com/flyinghearts/archive/2011/07/19/151417.html</guid><wfw:comment>http://www.shnenglu.com/flyinghearts/comments/151417.html</wfw:comment><comments>http://www.shnenglu.com/flyinghearts/archive/2011/07/19/151417.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/flyinghearts/comments/commentRss/151417.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/flyinghearts/services/trackbacks/151417.html</trackback:ping><description><![CDATA[<br /><div>銆銆鏅氫笂鎯寵窇涓▼搴忥紝緇撴灉VC 2010澶翠竴嬈$艦宸ワ細(xì)銆<br />            cl: 鍛戒護琛?error D8027 :鏃犳硶鎵ц“E:\prog\vc2010\bin\c1xx.dll”<br />     涓婄綉鎼滅儲浜嗕笅錛屼篃娌℃壘鍒頒竴涓В鍐蟲柟娉曪紙<a >瀹樻柟璇存槑</a>錛夈傛閮侀椃鐫錛岀獊鐒墮棿鎯沖埌cl.exe鍙互姝e父榪愯錛岃宑1xx.dll涓嶈兘姝e父榪愯錛屼細(xì)涓嶄細(xì)鏄痗1xx.dll鐨勪緷璧栧簱鍑洪棶棰樹簡錛屼簬鏄皟鍑篸ependency涓鏌ワ紝鏋滅劧灝戜簡涓猰svcp100.dll錛堜及璁℃槸鏌愪釜鍗歌澆杞歡閫犳垚鐨勶級錛屼粠鍒鎷瘋礉涓涓埌bin鐩綍錛岄棶棰樿В鍐熾?br /></div><img src ="http://www.shnenglu.com/flyinghearts/aggbug/151417.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2011-07-19 22:07 <a href="http://www.shnenglu.com/flyinghearts/archive/2011/07/19/151417.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <a href="http://www.shnenglu.com/">青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品</a> <div style="position:fixed;left:-9000px;top:-9000px;"><font id="pjuwb"></font><button id="pjuwb"><pre id="pjuwb"></pre></button><sub id="pjuwb"></sub><tbody id="pjuwb"><var id="pjuwb"><address id="pjuwb"></address></var></tbody><listing id="pjuwb"><label id="pjuwb"><strong id="pjuwb"></strong></label></listing><wbr id="pjuwb"><small id="pjuwb"><tbody id="pjuwb"></tbody></small></wbr><ins id="pjuwb"><xmp id="pjuwb"></xmp></ins><style id="pjuwb"></style><label id="pjuwb"><em id="pjuwb"><li id="pjuwb"></li></em></label><samp id="pjuwb"></samp><menu id="pjuwb"><input id="pjuwb"></input></menu><pre id="pjuwb"><tbody id="pjuwb"><tfoot id="pjuwb"><button id="pjuwb"></button></tfoot></tbody></pre><form id="pjuwb"></form><i id="pjuwb"><style id="pjuwb"><label id="pjuwb"><sup id="pjuwb"></sup></label></style></i><li id="pjuwb"><table id="pjuwb"><abbr id="pjuwb"></abbr></table></li><video id="pjuwb"></video><dfn id="pjuwb"></dfn><progress id="pjuwb"></progress><strong id="pjuwb"></strong><mark id="pjuwb"></mark><em id="pjuwb"></em><tbody id="pjuwb"><p id="pjuwb"><strike id="pjuwb"><acronym id="pjuwb"></acronym></strike></p></tbody><option id="pjuwb"></option><strike id="pjuwb"></strike><u id="pjuwb"></u><td id="pjuwb"><center id="pjuwb"><tr id="pjuwb"></tr></center></td><em id="pjuwb"><mark id="pjuwb"><em id="pjuwb"><tt id="pjuwb"></tt></em></mark></em><strong id="pjuwb"></strong><wbr id="pjuwb"></wbr><s id="pjuwb"></s><strong id="pjuwb"></strong><legend id="pjuwb"></legend><nav id="pjuwb"></nav><dl id="pjuwb"><th id="pjuwb"><dl id="pjuwb"></dl></th></dl><noframes id="pjuwb"><ins id="pjuwb"></ins></noframes><font id="pjuwb"></font><strike id="pjuwb"><i id="pjuwb"><style id="pjuwb"><label id="pjuwb"></label></style></i></strike><output id="pjuwb"></output><thead id="pjuwb"><pre id="pjuwb"></pre></thead><source id="pjuwb"></source><menuitem id="pjuwb"><wbr id="pjuwb"></wbr></menuitem><pre id="pjuwb"><span id="pjuwb"><pre id="pjuwb"><big id="pjuwb"></big></pre></span></pre><cite id="pjuwb"><fieldset id="pjuwb"><s id="pjuwb"><rt id="pjuwb"></rt></s></fieldset></cite><big id="pjuwb"><progress id="pjuwb"><big id="pjuwb"></big></progress></big><samp id="pjuwb"><delect id="pjuwb"></delect></samp><dl id="pjuwb"></dl><strike id="pjuwb"><nav id="pjuwb"><dl id="pjuwb"><strong id="pjuwb"></strong></dl></nav></strike><tbody id="pjuwb"><b id="pjuwb"><optgroup id="pjuwb"><rp id="pjuwb"></rp></optgroup></b></tbody><em id="pjuwb"></em><xmp id="pjuwb"><blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote></xmp> <i id="pjuwb"><abbr id="pjuwb"><i id="pjuwb"><abbr id="pjuwb"></abbr></i></abbr></i><center id="pjuwb"><acronym id="pjuwb"><center id="pjuwb"></center></acronym></center><pre id="pjuwb"></pre><ul id="pjuwb"><thead id="pjuwb"></thead></ul><blockquote id="pjuwb"><pre id="pjuwb"><sup id="pjuwb"></sup></pre></blockquote><acronym id="pjuwb"></acronym><big id="pjuwb"><s id="pjuwb"></s></big><th id="pjuwb"></th><th id="pjuwb"></th><tbody id="pjuwb"></tbody><thead id="pjuwb"><strike id="pjuwb"></strike></thead><th id="pjuwb"><dl id="pjuwb"><wbr id="pjuwb"></wbr></dl></th><dl id="pjuwb"><strong id="pjuwb"></strong></dl><abbr id="pjuwb"><noframes id="pjuwb"><noscript id="pjuwb"></noscript></noframes></abbr><td id="pjuwb"><ol id="pjuwb"></ol></td><li id="pjuwb"><noscript id="pjuwb"><abbr id="pjuwb"></abbr></noscript></li><small id="pjuwb"><bdo id="pjuwb"><nav id="pjuwb"></nav></bdo></small><style id="pjuwb"></style><optgroup id="pjuwb"><table id="pjuwb"></table></optgroup><center id="pjuwb"><tr id="pjuwb"><dfn id="pjuwb"></dfn></tr></center><th id="pjuwb"></th><u id="pjuwb"></u><tfoot id="pjuwb"><legend id="pjuwb"><i id="pjuwb"></i></legend></tfoot><mark id="pjuwb"></mark><meter id="pjuwb"></meter><nav id="pjuwb"></nav><acronym id="pjuwb"><pre id="pjuwb"><acronym id="pjuwb"><ul id="pjuwb"></ul></acronym></pre></acronym><acronym id="pjuwb"><pre id="pjuwb"><acronym id="pjuwb"><ul id="pjuwb"></ul></acronym></pre></acronym><nobr id="pjuwb"></nobr><sub id="pjuwb"><th id="pjuwb"><menuitem id="pjuwb"><wbr id="pjuwb"></wbr></menuitem></th></sub><thead id="pjuwb"><sub id="pjuwb"></sub></thead><ul id="pjuwb"><address id="pjuwb"><menuitem id="pjuwb"><meter id="pjuwb"></meter></menuitem></address></ul><dfn id="pjuwb"></dfn><pre id="pjuwb"></pre><input id="pjuwb"><cite id="pjuwb"><fieldset id="pjuwb"></fieldset></cite></input><u id="pjuwb"><form id="pjuwb"><u id="pjuwb"></u></form></u><kbd id="pjuwb"><em id="pjuwb"><mark id="pjuwb"></mark></em></kbd><tr id="pjuwb"></tr><del id="pjuwb"><form id="pjuwb"><address id="pjuwb"></address></form></del><tfoot id="pjuwb"><legend id="pjuwb"><ol id="pjuwb"><dl id="pjuwb"></dl></ol></legend></tfoot><menu id="pjuwb"><nobr id="pjuwb"><th id="pjuwb"><nobr id="pjuwb"></nobr></th></nobr></menu><fieldset id="pjuwb"></fieldset><pre id="pjuwb"><blockquote id="pjuwb"><samp id="pjuwb"></samp></blockquote></pre><xmp id="pjuwb"><sup id="pjuwb"><pre id="pjuwb"></pre></sup></xmp><span id="pjuwb"><progress id="pjuwb"></progress></span><font id="pjuwb"></font><var id="pjuwb"><abbr id="pjuwb"></abbr></var><strong id="pjuwb"><label id="pjuwb"><i id="pjuwb"><legend id="pjuwb"></legend></i></label></strong><tr id="pjuwb"><em id="pjuwb"><em id="pjuwb"><output id="pjuwb"></output></em></em></tr><thead id="pjuwb"><strike id="pjuwb"></strike></thead> <acronym id="pjuwb"></acronym><i id="pjuwb"></i><tt id="pjuwb"></tt><rt id="pjuwb"><source id="pjuwb"><rt id="pjuwb"></rt></source></rt><strike id="pjuwb"><acronym id="pjuwb"></acronym></strike><del id="pjuwb"></del><font id="pjuwb"><output id="pjuwb"><ins id="pjuwb"><output id="pjuwb"></output></ins></output></font><kbd id="pjuwb"><tr id="pjuwb"><kbd id="pjuwb"></kbd></tr></kbd><pre id="pjuwb"><sup id="pjuwb"><delect id="pjuwb"><samp id="pjuwb"></samp></delect></sup></pre><samp id="pjuwb"></samp><track id="pjuwb"></track><tr id="pjuwb"></tr><center id="pjuwb"></center><fieldset id="pjuwb"></fieldset><i id="pjuwb"></i><td id="pjuwb"></td><rt id="pjuwb"></rt><object id="pjuwb"></object><pre id="pjuwb"><progress id="pjuwb"><sub id="pjuwb"><thead id="pjuwb"></thead></sub></progress></pre><kbd id="pjuwb"><tr id="pjuwb"><option id="pjuwb"></option></tr></kbd><output id="pjuwb"><ins id="pjuwb"></ins></output><ol id="pjuwb"></ol><source id="pjuwb"></source><strong id="pjuwb"></strong><ruby id="pjuwb"></ruby><sub id="pjuwb"><meter id="pjuwb"><menuitem id="pjuwb"><meter id="pjuwb"></meter></menuitem></meter></sub><pre id="pjuwb"></pre><center id="pjuwb"></center><tr id="pjuwb"><tbody id="pjuwb"><xmp id="pjuwb"><dd id="pjuwb"></dd></xmp></tbody></tr><video id="pjuwb"></video><pre id="pjuwb"></pre><form id="pjuwb"><optgroup id="pjuwb"></optgroup></form><samp id="pjuwb"></samp><kbd id="pjuwb"></kbd><strong id="pjuwb"><option id="pjuwb"></option></strong><object id="pjuwb"></object><abbr id="pjuwb"><noframes id="pjuwb"><abbr id="pjuwb"></abbr></noframes></abbr><ul id="pjuwb"><del id="pjuwb"><button id="pjuwb"><pre id="pjuwb"></pre></button></del></ul><abbr id="pjuwb"></abbr><strong id="pjuwb"><code id="pjuwb"><strong id="pjuwb"></strong></code></strong><option id="pjuwb"></option><optgroup id="pjuwb"><bdo id="pjuwb"><code id="pjuwb"></code></bdo></optgroup><mark id="pjuwb"><em id="pjuwb"><font id="pjuwb"></font></em></mark><acronym id="pjuwb"><code id="pjuwb"></code></acronym><dl id="pjuwb"></dl><em id="pjuwb"></em><object id="pjuwb"><input id="pjuwb"><object id="pjuwb"></object></input></object><output id="pjuwb"><dd id="pjuwb"></dd></output><option id="pjuwb"><button id="pjuwb"><option id="pjuwb"></option></button></option><small id="pjuwb"></small></div> <a href="http://yiqiluntan.com" target="_blank">国产精品久久久久9999高清 </a>| <a href="http://asanny.com" target="_blank">日韩手机在线导航</a>| <a href="http://92ebook.com" target="_blank">老司机午夜精品视频</a>| <a href="http://vvvv81.com" target="_blank">久久爱另类一区二区小说</a>| <a href="http://xhamtube.com" target="_blank">国产美女精品视频</a>| <a href="http://by2565.com" target="_blank">久久久午夜视频</a>| <a href="http://guanghezixun.com" target="_blank">久久久久久国产精品一区</a>| <a href="http://chaoxibg.com" target="_blank">亚洲福利国产精品</a>| <a href="http://wwwjuhuase.com" target="_blank">亚洲日本欧美日韩高观看</a>| <a href="http://xiaocao-av.com" target="_blank">欧美日韩成人一区</a>| <a href="http://jiarenlady.com" target="_blank">亚洲男人天堂2024</a>| <a href="http://67idid.com" target="_blank">久久国产欧美日韩精品</a>| <a href="http://cc28256.com" target="_blank">91久久国产综合久久91精品网站</a>| <a href="http://tonglijinshu.com" target="_blank">欧美国产极速在线</a>| <a href="http://bmcshy.com" target="_blank">欧美四级伦理在线</a>| <a href="http://hellomusiczone.com" target="_blank">久久久一区二区</a>| <a href="http://fengxinye.com" target="_blank">美女福利精品视频</a>| <a href="http://xhamster0.com" target="_blank">亚洲影视九九影院在线观看</a>| <a href="http://www-90422.com" target="_blank">午夜国产不卡在线观看视频</a>| <a href="http://maoming365.com" target="_blank">亚洲二区三区四区</a>| <a href="http://toomicsvip.com" target="_blank">艳女tv在线观看国产一区</a>| <a href="http://hhsj31.com" target="_blank">国产亚洲aⅴaaaaaa毛片</a>| <a href="http://119552.com" target="_blank">亚洲电影专区</a>| <a href="http://rezel-zj.com" target="_blank">国产麻豆日韩</a>| <a href="http://811914.com" target="_blank">亚洲日本国产</a>| <a href="http://216667.com" target="_blank">国产一区二区精品丝袜</a>| <a href="http://zooxoft.com" target="_blank">91久久精品国产91久久性色</a>| <a href="http://bckxy.com" target="_blank">国产欧美视频一区二区</a>| <a href="http://xxxyyy168.com" target="_blank">亚洲激情国产</a>| <a href="http://sh-hxjdkj.com" target="_blank">国产一区二区三区久久精品</a>| <a href="http://9113i.com" target="_blank">亚洲精品国产精品国产自</a>| <a href="http://r6r4.com" target="_blank">国产亚洲精品aa午夜观看</a>| <a href="http://sp106.com" target="_blank">亚洲欧洲日本国产</a>| <a href="http://saobi6.com" target="_blank">激情文学综合丁香</a>| <a href="http://www-44442.com" target="_blank">亚洲视频一二区</a>| <a href="http://583775.com" target="_blank">亚洲国产中文字幕在线观看</a>| <a href="http://hnluvlux.com" target="_blank">亚洲在线日韩</a>| <a href="http://3990033.com" target="_blank">一区二区三区 在线观看视</a>| <a href="http://lorgou.com" target="_blank">欧美亚洲免费在线</a>| <a href="http://ynjzwh.com" target="_blank">亚洲一区二区视频在线观看</a>| <a href="http://62san.com" target="_blank">久久亚洲精选</a>| <a href="http://writeingo.com" target="_blank">欧美在线观看一区</a>| <a href="http://www3344uh.com" target="_blank">欧美午夜三级</a>| <a href="http://l5076.com" target="_blank">亚洲精品国久久99热</a>| <a href="http://www-5888c.com" target="_blank">怡红院av一区二区三区</a>| <a href="http://www36633.com" target="_blank">亚洲尤物影院</a>| <a href="http://fengxinye.com" target="_blank">亚洲一区亚洲</a>| <a href="http://js6996.com" target="_blank">欧美日韩高清在线观看</a>| <a href="http://by56677.com" target="_blank">欧美国产欧美亚洲国产日韩mv天天看完整 </a>| <a href="http://weixiao668.com" target="_blank">一区二区av在线</a>| <a href="http://www-00468.com" target="_blank">久久久久久97三级</a>| <a href="http://uu6623.com" target="_blank">久久精品日韩欧美</a>| <a href="http://haochen072.com" target="_blank">国产精品视频一二三</a>| <a href="http://337105.com" target="_blank">一区二区av在线</a>| <a href="http://shenduzhongcao.com" target="_blank">亚洲伦理在线免费看</a>| <a href="http://56myf.com" target="_blank">久久香蕉精品</a>| <a href="http://2061856.com" target="_blank">老牛国产精品一区的观看方式</a>| <a href="http://3dmh145.com" target="_blank">国产精品素人视频</a>| <a href="http://zyjzz.com" target="_blank">亚洲性视频网站</a>| <a href="http://www-44442.com" target="_blank">亚洲一区国产一区</a>| <a href="http://ximaimicro.com" target="_blank">欧美三级中文字幕在线观看</a>| <a href="http://maokk77.com" target="_blank">亚洲激情电影在线</a>| <a href="http://avse98.com" target="_blank">日韩亚洲一区二区</a>| <a href="http://94wr.com" target="_blank">欧美激情视频给我</a>| <a href="http://km43yy.com" target="_blank">亚洲欧洲精品一区二区三区波多野1战4</a>| <a href="http://6k6a.com" target="_blank">在线成人欧美</a>| <a href="http://www344399.com" target="_blank">久久中文精品</a>| <a href="http://160160160.com" target="_blank">欧美电影免费观看高清</a>| <a href="http://5101h.com" target="_blank">亚洲国产二区</a>| <a href="http://quoviajes.com" target="_blank">欧美高清在线视频</a>| <a href="http://szjyf668.com" target="_blank">亚洲日本欧美天堂</a>| <a href="http://yidaiban.com" target="_blank">亚洲一区二区精品在线</a>| <a href="http://7504329.com" target="_blank">国产精品成人一区二区艾草</a>| <a href="http://haose23.com" target="_blank">日韩一级视频免费观看在线</a>| <a href="http://mfgun.com" target="_blank">亚洲天堂av在线免费观看</a>| <a href="http://3333577.com" target="_blank">欧美日韩午夜在线</a>| <a href="http://91keshi.com" target="_blank">亚洲一区综合</a>| <a href="http://xingmaipet.com" target="_blank">久久视频精品在线</a>| <a href="http://www-136hk.com" target="_blank">在线精品国精品国产尤物884a</a>| <a href="http://4915w.com" target="_blank">久久人人九九</a>| <a href="http://yymh1056.com" target="_blank">亚洲黄色片网站</a>| <a href="http://pigkrtv.com" target="_blank">一本久久综合亚洲鲁鲁</a>| <a href="http://www4455va.com" target="_blank">国产精品久久久一区麻豆最新章节</a>| <a href="http://4430x.com" target="_blank">亚洲午夜激情在线</a>| <a href="http://bbbbyb.com" target="_blank">久久亚洲春色中文字幕</a>| <a href="http://mes-dvd.com" target="_blank">亚洲激情另类</a>| <a href="http://baigoso.com" target="_blank">欧美午夜精品电影</a>| <a href="http://67idid.com" target="_blank">欧美在线播放视频</a>| <a href="http://430390.com" target="_blank">欧美激情精品久久久久久免费印度</a>| <a href="http://by777131.com" target="_blank">亚洲精品美女久久久久</a>| <a href="http://srojsy.com" target="_blank">国产精品黄色</a>| <a href="http://xunlei520.com" target="_blank">久久九九全国免费精品观看</a>| <a href="http://by99969.com" target="_blank">欧美激情一二区</a>| <a href="http://yw8333.com" target="_blank">亚洲自拍16p</a>| <a href="http://t3gg.com" target="_blank">在线精品国产成人综合</a>| <a href="http://bcjianyan.com" target="_blank">欧美区在线播放</a>| <a href="http://fengboll.com" target="_blank">亚洲欧美日韩另类</a>| <a href="http://ssis378.com" target="_blank">欧美成人性网</a>| <a href="http://44cgcg.com" target="_blank">亚洲免费在线看</a>| <a href="http://ynzhuoyi.com" target="_blank">在线免费日韩片</a>| <a href="http://889644.com" target="_blank">欧美性生交xxxxx久久久</a>| <a href="http://cxjzcl.com" target="_blank">欧美在线观看日本一区</a>| <a href="http://by99969.com" target="_blank">91久久精品国产91性色tv</a>| <a href="http://kuaikan97.com" target="_blank">午夜精品久久久99热福利</a>| <a href="http://www23009.com" target="_blank">在线播放日韩欧美</a>| <a href="http://buyiker.com" target="_blank">国产精品久久久久久久浪潮网站</a>| <a href="http://kkwwxx.com" target="_blank">久久大香伊蕉在人线观看热2</a>| <a href="http://59199m.com" target="_blank">亚洲成色www8888</a>| <a href="http://04oy.com" target="_blank">欧美专区一区二区三区</a>| <a href="http://lgcpvip888.com" target="_blank">亚洲久久一区</a>| <a href="http://ourskycity.com" target="_blank">国产一区二区三区在线观看精品</a>| <a href="http://nxhjzddata.com" target="_blank">欧美成人一区二区三区</a>| <a href="http://e789a.com" target="_blank">欧美一级淫片播放口</a>| <a href="http://choaoxing.com" target="_blank">91久久综合亚洲鲁鲁五月天</a>| <a href="http://saomm18.com" target="_blank">久久久www成人免费精品</a>| <a href="http://www-tt211.com" target="_blank">夜夜爽99久久国产综合精品女不卡</a>| <a href="http://caofujia.com" target="_blank">国产日韩欧美一区二区</a>| <a href="http://448968.com" target="_blank">欧美日韩免费区域视频在线观看</a>| <a href="http://syfeichi.com" target="_blank">欧美资源在线观看</a>| <a href="http://dracotek.com" target="_blank">中文有码久久</a>| <a href="http://aiqianfang.com" target="_blank">亚洲日本免费</a>| <a href="http://saohu79.com" target="_blank">亚洲国产精品黑人久久久</a>| <a href="http://hbshwx.com" target="_blank">久久久久久久久蜜桃</a>| <a href="http://shenshijuesheying.com" target="_blank">亚洲素人在线</a>| <a href="http://zucai168.com" target="_blank">日韩亚洲一区二区</a>| <a href="http://xxxx48.com" target="_blank">亚洲国产美女久久久久</a>| <a href="http://www497171c.com" target="_blank">国产婷婷一区二区</a>| <a href="http://jiajianpei.com" target="_blank">国产精品黄色在线观看</a>| <a href="http://868482.com" target="_blank">欧美另类在线观看</a>| <a href="http://qkspvip.com" target="_blank">欧美电影在线免费观看网站</a>| <a href="http://xshgwy.com" target="_blank">久久久夜夜夜</a>| <a href="http://9885888.com" target="_blank">久久精品1区</a>| <a href="http://66gg6.com" target="_blank">久久电影一区</a>| <a href="http://zuan3344.com" target="_blank">欧美与欧洲交xxxx免费观看</a>| <a href="http://hzdss.com" target="_blank">亚洲少妇诱惑</a>| <a href="http://www-s8.com" target="_blank">亚洲色图综合久久</a>| <a href="http://669528.com" target="_blank">在线视频一区观看</a>| <a href="http://430390.com" target="_blank">一本大道久久a久久精品综合</a>| <a href="http://666777v3.com" target="_blank">亚洲国产经典视频</a>| <a href="http://timonna.com" target="_blank">亚洲电影免费</a>| <a href="http://www-s8.com" target="_blank">亚洲国产精品欧美一二99</a>| <a href="http://0999555.com" target="_blank">免费观看一区</a>| <a href="http://www149aa.com" target="_blank">欧美大片一区</a>| <a href="http://bjayj.com" target="_blank">亚洲国产精品123</a>| <a href="http://laoyewo.com" target="_blank">亚洲高清在线</a>| <a href="http://amass-ic.com" target="_blank">亚洲国产日韩欧美在线图片</a>| <a href="http://www35353.com" target="_blank">欧美粗暴jizz性欧美20</a>| <a href="http://y3u7.com" target="_blank">亚洲第一福利在线观看</a>| <a href="http://969093.com" target="_blank">亚洲第一精品夜夜躁人人躁</a>| <a href="http://baixinlocal.com" target="_blank">欧美大片免费观看</a>| <a href="http://www297777.com" target="_blank">欧美激情片在线观看</a>| <a href="http://666cmc.com" target="_blank">亚洲国产精品久久久久秋霞影院 </a>| <a href="http://5s5s5s.com" target="_blank">欧美一级片一区</a>| <a href="http://sese750.com" target="_blank">欧美伊久线香蕉线新在线</a>| <a href="http://bgflee.com" target="_blank">欧美一区1区三区3区公司</a>| <a href="http://wwwby2232.com" target="_blank">午夜精品影院</a>| <a href="http://3644688.com" target="_blank">久久久久久久综合日本</a>| <a href="http://my7877.com" target="_blank">另类成人小视频在线</a>| <a href="http://babylonmovi.com" target="_blank">理论片一区二区在线</a>| <a href="http://4254888.com" target="_blank">欧美精品一区二区三区一线天视频 </a>| <a href="http://seanzhau.com" target="_blank">久久精品国产999大香线蕉</a>| <a href="http://jjoo4.com" target="_blank">久久久7777</a>| <a href="http://13789a.com" target="_blank">欧美国产三区</a>| <a href="http://794579.com" target="_blank">一区二区国产在线观看</a>| <a href="http://ategpu.com" target="_blank">午夜欧美不卡精品aaaaa</a>| <a href="http://tareandshare.com" target="_blank">久久精品夜色噜噜亚洲aⅴ</a>| <a href="http://318823.com" target="_blank">模特精品在线</a>| <a href="http://www51avav.com" target="_blank">国产精品福利久久久</a>| <a href="http://9ctv2.com" target="_blank">国产最新精品精品你懂的</a>| <a href="http://www134rr.com" target="_blank">亚洲国产一区二区视频</a>| <a href="http://372469.com" target="_blank">亚洲图片欧洲图片日韩av</a>| <a href="http://4438x28.com" target="_blank">欧美在线视频观看</a>| <a href="http://yiqiluntan.com" target="_blank">欧美二区在线播放</a>| <a href="http://ddnwater.com" target="_blank">亚洲视频999</a>| <a href="http://h7yy.com" target="_blank">久久美女性网</a>| <a href="http://ahqdlq.com" target="_blank">国产精品成人免费</a>| <a href="http://vvvv81.com" target="_blank">精品福利电影</a>| <a href="http://123086.com" target="_blank">亚洲影院在线观看</a>| <a href="http://aijiaoji.com" target="_blank">免费中文字幕日韩欧美</a>| <a href="http://783956.com" target="_blank">一本色道久久综合亚洲精品不</a>| <a href="http://012928.com" target="_blank">午夜精品短视频</a>| <a href="http://baoyu1313.com" target="_blank">欧美黄色视屏</a>| <a href="http://eastasp.com" target="_blank">红杏aⅴ成人免费视频</a>| <a href="http://456888com.com" target="_blank">99国产麻豆精品</a>| <a href="http://www-188445.com" target="_blank">久久精品在线视频</a>| <a href="http://8332777.com" target="_blank">亚洲精品一区二区三区蜜桃久</a>| <a href="http://56qn.com" target="_blank">午夜精品久久久</a>| <a href="http://wy77777.com" target="_blank">欧美日韩国产欧</a>| <a href="http://4254888.com" target="_blank">一区二区视频在线观看</a>| <a href="http://345fz.com" target="_blank">亚洲欧美精品suv</a>| <a href="http://junhuatesu.com" target="_blank">亚洲大片免费看</a>| <a href="http://xian369.com" target="_blank">欧美一区二区三区婷婷月色 </a>| <a href="http://www227ee.com" target="_blank">亚洲日韩欧美视频</a>| <a href="http://360inns.com" target="_blank">久久国产精品电影</a>| <a href="http://978769.com" target="_blank">日韩视频一区二区在线观看</a>| <a href="http://8868866.com" target="_blank">久久久91精品国产一区二区精品</a>| <a href="http://7kz6.com" target="_blank">欧美婷婷六月丁香综合色</a>| <a href="http://www17bxbx.com" target="_blank">亚洲电影免费</a>| <a href="http://www-37277.com" target="_blank">久久久久国产一区二区三区</a>| <a href="http://v58q.com" target="_blank">一本大道av伊人久久综合</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>