锘??xml version="1.0" encoding="utf-8" standalone="yes"?>黑人巨大精品欧美黑白配亚洲,亚洲国产中文字幕在线观看,亚洲欧美日韩一区二区三区在线观看 http://m.shnenglu.com/flyinghearts/zh-cnMon, 29 Sep 2025 22:48:23 GMTMon, 29 Sep 2025 22:48:23 GMT60SEH寮傚父澶勭悊涓撳埄鍒版湡浜?/title><link>http://m.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://m.shnenglu.com/flyinghearts/archive/2014/06/15/207288.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/207288.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2014/06/15/207288.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/207288.html</wfw:commentRss><trackback:ping>http://m.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://m.shnenglu.com/flyinghearts/aggbug/207288.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2014-06-15 10:55 <a href="http://m.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://m.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://m.shnenglu.com/flyinghearts/archive/2013/03/21/198695.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/198695.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2013/03/21/198695.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/198695.html</wfw:commentRss><trackback:ping>http://m.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;鐨勬儏鍐碉細鍙互鎵懼埌涓縐嶆柟娉曪紝灝嗘暟緇勫垝鍒嗕負涓ら儴鍒嗭紝涓旇榪欎袱涓暟鍒嗗埆鍦ㄤ笉鍚岄儴鍒嗭紝榪欐牱姣忛儴鍒嗘墍鏈夋暟鐨勫紓鎴栧鹼紝鎭板ソ鍒嗗埆絳変簬榪欎袱涓暟銆備竴縐嶇畝鍗曠殑鍒嗘硶灝辨槸錛屽厛璁$畻鍑鴻繖涓や釜鏁扮殑寮傛垨鍊?/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";">浣嶏紝鐒跺悗鏍規嵁</span> +k<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">浣嶆槸鍚︿負</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";">鍥炲埌鍘熼錛屽亣璁捐繖涓変釜涓嶅悓鐨勬暟鏄細</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";">鍊煎彲鑳戒負</span>0<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屼篃鍙兘涓嶄負</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";">鏃訛紙姣斿錛氳繖涓変釜鏁頒負</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";">鍊間負</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛夛紝寰堥毦鎵懼埌涓縐嶆柟娉曪紝灝嗗師鏉ョ殑鏁扮粍鍒掑垎涓轟袱閮ㄥ垎錛屼嬌寰楄繖涓変釜鏁頒笉閮藉湪鍚屼竴閮ㄥ垎銆傚洜鑰岋紝<strong>瑕佸厛瀵瑰師鏉ョ殑鏁扮粍榪涜涓嬈℃浛鎹細灝嗘瘡涓暟涓?/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";">銆傝繖鏍峰師鏉ョ殑涓変釜鏁板氨鍙樻垚浜嗭細</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;">鑻ヤ笁涓暟鐨勫紓鎴栧間負</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;">涓轟換鎰忓鹼級涓婁負</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;">浣嶄笂蹇呯劧涓涓負</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;">0</span></strong><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛堜笉鐒剁殑璇濓紝榪欎笁涓暟鐨勫紓鎴栧煎氨涓嶄細涓?/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;">浣嶄負</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";">銆傝瘉鏄庯細涓嶅Θ璁?/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";">浣嶄笂蹇呯劧鏄竴涓負</span>1<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">錛屼竴涓負</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";">浣嶄負</span>1<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(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";">浣嶄負</span>0<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><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";">鏀懼叆鍘熸潵鐨勬暟緇勶紝闂杞負</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";">鍙﹀瑕佺壒鍒敞鎰忕殑鏄紝涓浜涜綆楁渶濂藉厛杞負鏃犵鍙鋒暟錛岄伩鍏嶆孩鍑猴紝鏈鍚庡啀杞洖鏈夌鍙鋒暟銆傚洜涓烘爣鍑嗗亣瀹氭湁絎﹀彿鏁伴棿鐨勮綆椾笉鍙戠敓婧㈠嚭錛屽綋瀹為檯涓婂彂鐢熸孩鍑烘椂錛屽氨鏄?/span>UB<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman";">琛屼負錛岀紪璇戝櫒鑻ヨ繘琛屼簺嬋榪涚殑浼樺寲灝卞緱涓嶅埌姝g‘緇撴灉銆?/span></p> <p style="text-indent:21.0pt;"> </p><img src ="http://m.shnenglu.com/flyinghearts/aggbug/198695.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2013-03-21 22:00 <a href="http://m.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://m.shnenglu.com/flyinghearts/archive/2013/03/21/198694.htmlflyingheartsflyingheartsThu, 21 Mar 2013 13:51:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2013/03/21/198694.htmlhttp://m.shnenglu.com/flyinghearts/comments/198694.htmlhttp://m.shnenglu.com/flyinghearts/archive/2013/03/21/198694.html#Feedback0http://m.shnenglu.com/flyinghearts/comments/commentRss/198694.htmlhttp://m.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;

 鏍規嵁msdn, lpClass鐨勭被鍨嬪簲璇ユ槸 LPSTR錛?w32api鍗村皢鍏跺0鏄庝負 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://m.shnenglu.com/flyinghearts/archive/2012/11/22/195570.htmlflyingheartsflyingheartsThu, 22 Nov 2012 11:49:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2012/11/22/195570.htmlhttp://m.shnenglu.com/flyinghearts/comments/195570.htmlhttp://m.shnenglu.com/flyinghearts/archive/2012/11/22/195570.html#Feedback4http://m.shnenglu.com/flyinghearts/comments/commentRss/195570.htmlhttp://m.shnenglu.com/flyinghearts/services/trackbacks/195570.html
1 auto 浼氳嚜鍔ㄦ妸 寮曠敤 鍘婚櫎鎺?br /> 
  int& get();
  auto k = get();     // k鐨勭被鍨嬫槸int錛岃屼笉鏄痠nt&
 
  Derived object;
  auto&    same_object = (Base&)object;      
  auto  another_object = (Base&)object;  //浼氶噸鏂版瀯閫犱釜Base瀵硅薄  
 
    
2 decltype 鏈夋椂浼氳嚜鍔ㄦ妸 寮曠敤 鍔犱笂

  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 寮曞叆 鍙沖煎紩鐢紝鍙互鍋氬埌錛氬嚱鏁拌漿鍙戙侀拡瀵逛復鏃跺璞′紭鍖?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&&鐨勮瘽錛屽氨浼氭湁鍓綔鐢細
 
  void increase(int& value) { ++value; }
  void test3(int&& value) { increase(value); }
 
  char ch = 'a';
  test3(ch);  //鏈剰鏄敼鍙榗h鍊鹼紝浣嗗疄闄呬笂ch鍊間笉浼氭敼鍙橈紝鏀瑰彉鐨勬槸涓存椂瀵瑰儚
  閫氳繃杞彂鍑芥暟test3錛宨ncrease鍑芥暟鍙互淇敼涓存椂瀵瑰儚錛?br />  榪欓犳垚紼嬪簭鍛樼姱鐨勯敊璇紙濡備笂闈㈢殑渚嬪瓙錛夛紝闅句互鍦ㄧ紪璇戞椂灝辮鎵懼嚭鏉ャ?br /> 
 
  std::forward<T>(value) 絳変環浜?static_cast<T&&>(value)錛屾劅瑙夊悗鑰呮洿瀹規槗鐞嗚В銆?br />  std::forward 璧峰埌鐨勮漿鍙戜綔鐢ㄣ傚鏋淭綾誨瀷涓?R&銆?R&&錛岀粡榪囩被鍨嬭漿鎹㈠悗錛屽叾綾誨瀷榪樻槸鍜屽師鏉ョ殑涓鏍楓?br />  鍦–++11涓?
    R&  &   絳夊悓浜?R&   錛堝湪c++03涓紝R& &榪欑鍐欐硶鏄潪娉曠殑錛?br />    R&& &   絳夊悓浜?R&
    R&  &&  絳夊悓浜?R&
    R&& &&  絳夊悓浜?R&&
 

]]>
decltype鐨勫皬鈥滈櫡闃扁?/title><link>http://m.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://m.shnenglu.com/flyinghearts/archive/2012/08/14/187204.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/187204.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2012/08/14/187204.html#Feedback</comments><slash:comments>5</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/187204.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/flyinghearts/services/trackbacks/187204.html</trackback:ping><description><![CDATA[int x;<br /><div>decltype(x) 鍜?nbsp; decltype((x))    鐨勭被鍨嬫槸涓嶄竴鏍風殑銆?/div><div>decltype(x) 鍜?nbsp; decltype(*&x)   鐨勭被鍨嬫槸涓嶄竴鏍風殑銆?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://m.shnenglu.com/flyinghearts/aggbug/187204.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-08-14 21:19 <a href="http://m.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://m.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://m.shnenglu.com/flyinghearts/archive/2012/08/05/186382.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/186382.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2012/08/05/186382.html#Feedback</comments><slash:comments>8</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/186382.html</wfw:commentRss><trackback:ping>http://m.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錛屽嵆杞彂鍑芥暟涓嶄細璋冭妭鏍堬紝鐢變簬鍦╟_call錛宲op eax錛屼嬌esp澶氬姞浜?錛屽洜鑰屽湪璋冪敤瀹宑_call鍚庡簲璇ユ墜鍔ㄥ皢esp鍊煎噺4錛屼繚璇佹爤騫寵 銆?br />    <div>    褰撹漿鍙戝嚱鏁版槸__stdcall錛岃漿鍙戝嚱鏁頒細璋冭妭鏍堬紝璋冪敤杞彂鍑芥暟瀹屾瘯鍚庯紝鏍堝凡緇忎繚鎸佸鉤琛★紝鍥犺岃皟鐢╟_call瀹屾瘯錛屼笉搴旇榪涜鏍堟寚閽堣皟鑺傘備技涔庡皢c_call鐨勮皟鐢ㄦ敼涓篲_stdcall鍗沖彲錛屼絾瀹為檯涓奵_call鏈夊彉闀垮弬鏁幫紝鏀規垚__stdcall娌℃晥鏋滐紝姣忔璋冪敤緙栬瘧鍣ㄨ繕鏄細鑷姩鐢熸垚璋冭妭鏍堟寚閽堜唬鐮併傚洜鑰屽彧鑳芥瘡嬈¤皟鐢ㄥ畬姣曪紝緙栬瘧鍣ㄧ粰esp鍔犱簡澶氬皯錛屽氨鎵嬪姩鍑忓灝戙傦紙緙栬瘧鍣ㄤ笉涓瀹氫細鐢熸垚 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://m.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://m.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://m.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://m.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://m.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://m.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://m.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://m.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://m.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://m.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://m.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://m.shnenglu.com/flyinghearts/aggbug/186382.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-08-05 21:02 <a href="http://m.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://m.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://m.shnenglu.com/flyinghearts/archive/2012/05/15/175005.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/175005.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2012/05/15/175005.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/175005.html</wfw:commentRss><trackback:ping>http://m.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://m.shnenglu.com/flyinghearts/aggbug/175005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-05-15 20:26 <a href="http://m.shnenglu.com/flyinghearts/archive/2012/05/15/175005.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓夊浗蹇?鍓ф湰淇敼鍣?1.2http://m.shnenglu.com/flyinghearts/archive/2012/05/15/175004.htmlflyingheartsflyingheartsTue, 15 May 2012 12:14:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2012/05/15/175004.htmlhttp://m.shnenglu.com/flyinghearts/comments/175004.htmlhttp://m.shnenglu.com/flyinghearts/archive/2012/05/15/175004.html#Feedback0http://m.shnenglu.com/flyinghearts/comments/commentRss/175004.htmlhttp://m.shnenglu.com/flyinghearts/services/trackbacks/175004.html鍐呯疆鍓ф湰鏀逛負鍔犲己鐗堝墽鏈紝淇濆瓨鍓ф湰鏃訛紝鍚屾椂鐢熸垚鏅氱増/鍔犲己鐗堝墽鏈?br />錛堟病鏃墮棿嫻嬭瘯錛屽彲鑳藉湪鏇存敼瀹濈墿鎵鏈夎呮椂錛屼細鏈変竴浜沚ug錛?br />
涓夊浗蹇?鍓ф湰淇敼鍣?.2
 

]]>
瀹夊叏鐨勬暣鏁版瘮杈?/title><link>http://m.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://m.shnenglu.com/flyinghearts/archive/2012/03/30/169554.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/169554.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2012/03/30/169554.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/169554.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/flyinghearts/services/trackbacks/169554.html</trackback:ping><description><![CDATA[<br />鍓嶅嚑澶╁湪姘存瘝涓婄湅鍒扮殑棰橈細<br /><br /><div>姝e父鐨勬瘮杈?assert(-1 < 1U) 鏄細澶辮觸鐨勩傚洜涓?-1 浼氭彁鍗囨垚鏃犵鍙鋒暟銆?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>浣嗙敱浜庤繘琛屾瘮杈冪殑涓や釜鏁板彲鑳藉垎鍒槸錛氭湁絎﹀彿鏁板拰鏃犵鍙鋒暟錛岀紪璇戞椂緙栬瘧鍣ㄤ細緇欏嚭澶ч噺鐨勮鍛娿?br /><br />     瑕侀伩鍏嶆湁絎﹀彿鏁板拰鏃犵鍙鋒暟鐨勮繘琛岀洿鎺ユ瘮杈冿紝灝卞繀欏誨皢瀹冧滑閮借漿涓哄悓涓涓被鍨婽銆傝繖涓被鍨嬬殑紜畾鍙互閲囩敤涓ょ鏂規硶錛?br /><br />     1 姣旇緝鍘熸潵涓や釜綾誨瀷鏄惁鏄湁絎﹀彿鏁頒互鍙婂畠浠墍鍗犵敤鐨勫瓧鑺傛暟錛屾潵鎺ㄦ柇鍑哄簲璇ュ皢瀹冧滑閮借漿涓哄摢縐嶇被鍨婽錛岃繖鏄痸c閭d釜safeint鐨勫仛娉曘?br /><br />     2 閲囩敤榪欎釜trick錛氬皢榪欎袱涓被鍨嬬殑鏁幫紙鏁板彲浠ュ彇0錛夌洿鎺ョ浉鍔狅紝寰楀埌鐨勭粨鏋滅殑綾誨瀷灝辨槸鎵姹傜殑銆傝繖鏄洜涓猴細涓や釜鏁拌繘琛屾瘮杈冩椂錛岄噰鐢ㄧ殑綾誨瀷杞崲瑙勫垯鍜屼袱涓暟鐩稿姞鏃舵墍閲囩敤鐨勮鍒欐槸涓鑷寸殑銆?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://m.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://m.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">鏀規垚鍚庣殑浠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 />  浣嗕笂闈㈢殑鍐欐硶鏈変竴涓棶棰橈細濡傛灉涓涓?short鍜屼竴涓猽nsigned char榪涜姣旇緝錛岀紪璇戝櫒閮芥槸杞負int榪涜姣旇緝錛屾病鏈夊繀瑕佽繘琛岀壒孌婂鐞嗭紙涓婇潰鐨勪唬鐮佸鐞嗗悗浼氬涓涓笌0鐨勬瘮杈冿級銆傚疄闄呬笂錛屽鏋滀袱涓被鍨嬮兘鏄漿涓烘湁絎﹀彿綾誨瀷錛屽彲浠ョ洿鎺ヨ繘琛屾瘮杈冦?/div>鏈緇堜唬鐮侊細<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://m.shnenglu.com/flyinghearts/aggbug/169554.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-03-30 20:16 <a href="http://m.shnenglu.com/flyinghearts/archive/2012/03/30/169554.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>闈㈣瘯棰樼簿瑙?鐩綍http://m.shnenglu.com/flyinghearts/archive/2012/03/18/168270.htmlflyingheartsflyingheartsSun, 18 Mar 2012 14:24:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2012/03/18/168270.htmlhttp://m.shnenglu.com/flyinghearts/comments/168270.htmlhttp://m.shnenglu.com/flyinghearts/archive/2012/03/18/168270.html#Feedback0http://m.shnenglu.com/flyinghearts/comments/commentRss/168270.htmlhttp://m.shnenglu.com/flyinghearts/services/trackbacks/168270.html鐩?nbsp; 褰?/div>


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

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



]]>闈㈣瘯棰樼簿瑙d箣浜岋細 瀛楃涓層佹暟緇勶紙1錛?/title><link>http://m.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://m.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/168269.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/168269.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/flyinghearts/services/trackbacks/168269.html</trackback:ping><description><![CDATA[     鎽樿: 闈㈣瘯棰樼簿瑙d箣浜岋細 瀛楃涓層佹暟緇勶紙1錛?  鏈瘒鏂囩珷鍙戣〃鍦ㄤ笅闈笁涓崥瀹腑錛屽鏋滃嚭鐜版帓鐗堥棶棰橈紝璇風Щ姝ュ埌鍙︿竴涓崥瀹€?http://m.shnenglu.com/flyinghearts http://www.cnblogs.com/flyinghearts http://blog.csdn.net/flyinghearts   1   ...  <a href='http://m.shnenglu.com/flyinghearts/archive/2012/03/18/168269.html'>闃呰鍏ㄦ枃</a><img src ="http://m.shnenglu.com/flyinghearts/aggbug/168269.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-03-18 21:28 <a href="http://m.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://m.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://m.shnenglu.com/flyinghearts/archive/2012/03/18/168267.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/168267.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2012/03/18/168267.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/168267.html</wfw:commentRss><trackback:ping>http://m.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"">銆傚叿浣撳仛娉曚負錛?/span></p> <p style="text-indent:21.0pt;"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">璁撅細</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"">鏍規嵁</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"">綆楁硶铏界劧綆鍗曪紝浣嗗疄鐜拌搗鏉ワ紝鍗存湁涓涓緢澶ч棶棰橈細璁$畻</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"">錛屼竴涓敼榪涚殑鏂規硶鏄細</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"">浣嗚繖鏍風殑鍋氭硶錛屽茍涓嶈兘瑙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>姣忚繘琛屼竴嬈″姞鍑忚繍綆楁椂錛岄兘鍙栫粨鏋滀負鍘熺粨鏋滈櫎浠ヤ竴涓凍澶熷ぇ鐨勫父鏁?/span>M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鐨勪綑鏁般傝繖鏍峰姞鍑忚繍綆椾腑錛屽氨涓嶄細鐜扮幇婧㈠嚭闂銆傛渶鍚庡啀鐢?/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"">鏀逛負璁$畻錛?/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"">浠庤〃闈笂鐪嬶紝閲囩敤妯¤繍綆楀悗錛岃綆楅噺浼氬鍔犲緢澶氥備絾瀹為檯涓婏紝鑻?/span>M<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍙栧悎閫傜殑鍊兼椂錛岃綆楅噺騫朵笉浼氬鍔狅紒錛?/span></p> <p> </p> <p style="text-indent:21.75pt"><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">鍏堝洖欏句笅璁$畻鏈哄熀鏈煡璇嗭細涓や釜鍚?/span>N<span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">浣嶏紙瀵勫瓨鍣ㄤ負</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"">浼氭庝箞澶勭悊錛熷綋鐒舵槸灝嗘孩鍑虹殑閭d竴浣嶅拷鐣ユ帀錛堝彲鑳借繕瑕佽緗笅婧㈠嚭鏍囧織錛夛紝寰楀埌鐨勭粨鏋滃疄闄呬笂鏄細</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暣鏁板彇鍙嶅悗鍔?/span>1<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>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"">浜嗚В浜嗚繖浜涳紝灝變笉浼氬鎬?/span>C/C++<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"">鍥犺岋紝鍦ㄥ</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"">鐨勫彇鍊艱寖鍥翠負錛?/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"">鐨勫彇鍊艱寖鍥翠負錛?/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"">鏍規嵁</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"">鐢ㄥ叕寮忚綆楁墍鏈夋暟瀛楃殑鍜屻佸鉤鏂瑰拰鏃訛紝鍙兘鍑虹幇鐨勯棶棰橈細</span></p> <p><span>   </span><span style="font-family:瀹嬩綋;Times New Roman";Times New Roman"">妯¤繍綆楁弧瓚籌細</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"">鑰屽簲璇ュ啓鎴愶細</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"">鎴栬咃細</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; ">娉ㄦ剰涓や釜鏁扮殑涔樼Н鏄惁浼氭孩鍑?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://m.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://m.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://m.shnenglu.com/flyinghearts/aggbug/168267.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-03-18 21:16 <a href="http://m.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://m.shnenglu.com/flyinghearts/archive/2012/02/28/166717.htmlflyingheartsflyingheartsTue, 28 Feb 2012 14:14:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2012/02/28/166717.htmlhttp://m.shnenglu.com/flyinghearts/comments/166717.htmlhttp://m.shnenglu.com/flyinghearts/archive/2012/02/28/166717.html#Feedback11http://m.shnenglu.com/flyinghearts/comments/commentRss/166717.htmlhttp://m.shnenglu.com/flyinghearts/services/trackbacks/166717.html闃呰鍏ㄦ枃

]]>
闈㈣瘯棰樼簿瑙d箣涓錛?浜屽弶鏍?/title><link>http://m.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://m.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/166713.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/166713.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/flyinghearts/services/trackbacks/166713.html</trackback:ping><description><![CDATA[     鎽樿: 闈㈣瘯棰樼簿瑙d箣涓錛?浜屽弶鏍?  鏈瘒鏂囩珷鍙戣〃鍦ㄤ笅闈笁涓崥瀹腑錛屽鏋滃嚭鐜版帓鐗堥棶棰橈紝璇風Щ姝ュ埌鍙︿竴涓崥瀹€?http://m.shnenglu.com/flyinghearts http://www.cnblogs.com/flyinghearts http://blog.csdn.net/flyinghearts   1     姹備簩鍙夋爲涓浉...  <a href='http://m.shnenglu.com/flyinghearts/archive/2012/02/28/166713.html'>闃呰鍏ㄦ枃</a><img src ="http://m.shnenglu.com/flyinghearts/aggbug/166713.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2012-02-28 20:54 <a href="http://m.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://m.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://m.shnenglu.com/flyinghearts/archive/2011/09/23/156635.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/156635.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2011/09/23/156635.html#Feedback</comments><slash:comments>7</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/156635.html</wfw:commentRss><trackback:ping>http://m.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;">絀虹摱鎹㈡苯姘存鏁幫細</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 % (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: 瀹嬩綋;">錛屾樉鐒訛紝絀虹摱鎹㈡苯姘存鏁頒負</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: 瀹嬩綋;">絀虹摱鎹㈡苯姘存鏁幫細</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: 瀹嬩綋;">鏈鍚庡墿浣欑┖鐡訛細</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: 瀹嬩綋;">絀虹摱鎹㈡苯姘存鏁幫細</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;">絀虹摱鎹㈡苯姘存鏁幫細</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;">鏈鍚庡墿浣欑┖鐡訛細</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: 瀹嬩綋;">瀵瑰師棰橈細</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://m.shnenglu.com/flyinghearts/aggbug/156635.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2011-09-23 19:45 <a href="http://m.shnenglu.com/flyinghearts/archive/2011/09/23/156635.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>涓夊浗蹇?鍓ф湰淇敼鍣?1.1http://m.shnenglu.com/flyinghearts/archive/2011/08/07/152739.htmlflyingheartsflyingheartsSun, 07 Aug 2011 15:24:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2011/08/07/152739.htmlhttp://m.shnenglu.com/flyinghearts/comments/152739.htmlhttp://m.shnenglu.com/flyinghearts/archive/2011/08/07/152739.html#Feedback1http://m.shnenglu.com/flyinghearts/comments/commentRss/152739.htmlhttp://m.shnenglu.com/flyinghearts/services/trackbacks/152739.html  緇欎互鍓嶅啓鐨勫墽鏈慨鏀瑰櫒錛屽姞浜嗕釜鐣岄潰錛屾湰鎯崇敤wtl錛屼絾鏄唬鐮佷腑鐢ㄥ埌涓嶅皯“鍒濆鍖栧垪琛?#8221;絳塩++11鏂扮壒鎬э紝鍙ソ璁¬C2010闈犺竟绔欎簡銆傚mingw錛屽ソ鐢ㄧ殑gui搴撹繕鐪熸病鏈夛紝鎯蟲兂灝卞崄鍑犱釜娑堟伅錛屽共鑴嗙洿鎺ヨ皟鐢╳indows api寰椾簡銆?br />


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

 

鎬濊礬錛氱敱浜庢暟緇勫厓绱犳誨拰鏄浐瀹氬鹼紝鍥犺岃法澶淬佸熬鐨勮繛緇瓙鏁扮粍鍜屾渶澶э紝絳変環浜庢眰 涓棿閭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://m.shnenglu.com/flyinghearts/archive/2011/07/20/151511.htmlflyingheartsflyingheartsWed, 20 Jul 2011 15:39:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2011/07/20/151511.htmlhttp://m.shnenglu.com/flyinghearts/comments/151511.htmlhttp://m.shnenglu.com/flyinghearts/archive/2011/07/20/151511.html#Feedback0http://m.shnenglu.com/flyinghearts/comments/commentRss/151511.htmlhttp://m.shnenglu.com/flyinghearts/services/trackbacks/151511.html闃呰鍏ㄦ枃

]]>
Fibonacci鏁板垪鐨勪袱縐峅(lgn)瑙f硶http://m.shnenglu.com/flyinghearts/archive/2011/07/20/151510.htmlflyingheartsflyingheartsWed, 20 Jul 2011 15:30:00 GMThttp://m.shnenglu.com/flyinghearts/archive/2011/07/20/151510.htmlhttp://m.shnenglu.com/flyinghearts/comments/151510.htmlhttp://m.shnenglu.com/flyinghearts/archive/2011/07/20/151510.html#Feedback0http://m.shnenglu.com/flyinghearts/comments/commentRss/151510.htmlhttp://m.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://m.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://m.shnenglu.com/flyinghearts/archive/2011/07/19/151417.html</guid><wfw:comment>http://m.shnenglu.com/flyinghearts/comments/151417.html</wfw:comment><comments>http://m.shnenglu.com/flyinghearts/archive/2011/07/19/151417.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.shnenglu.com/flyinghearts/comments/commentRss/151417.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/flyinghearts/services/trackbacks/151417.html</trackback:ping><description><![CDATA[<br /><div>銆銆鏅氫笂鎯寵窇涓▼搴忥紝緇撴灉VC 2010澶翠竴嬈$艦宸ワ細銆<br />            cl: 鍛戒護琛?error D8027 :鏃犳硶鎵ц“E:\prog\vc2010\bin\c1xx.dll”<br />     涓婄綉鎼滅儲浜嗕笅錛屼篃娌℃壘鍒頒竴涓В鍐蟲柟娉曪紙<a >瀹樻柟璇存槑</a>錛夈傛閮侀椃鐫錛岀獊鐒墮棿鎯沖埌cl.exe鍙互姝e父榪愯錛岃宑1xx.dll涓嶈兘姝e父榪愯錛屼細涓嶄細鏄痗1xx.dll鐨勪緷璧栧簱鍑洪棶棰樹簡錛屼簬鏄皟鍑篸ependency涓鏌ワ紝鏋滅劧灝戜簡涓猰svcp100.dll錛堜及璁℃槸鏌愪釜鍗歌澆杞歡閫犳垚鐨勶級錛屼粠鍒鎷瘋礉涓涓埌bin鐩綍錛岄棶棰樿В鍐熾?br /></div><img src ="http://m.shnenglu.com/flyinghearts/aggbug/151417.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/flyinghearts/" target="_blank">flyinghearts</a> 2011-07-19 22:07 <a href="http://m.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://m.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://baoyu1313.com" target="_blank">久久另类ts人妖一区二区</a>| <a href="http://tigerpowerinc.com" target="_blank">亚洲精品视频在线观看网站 </a>| <a href="http://yiqipapa8.com" target="_blank">亚洲欧美综合另类中字</a>| <a href="http://56lin.com" target="_blank">久久久久久噜噜噜久久久精品</a>| <a href="http://cnlbogs.com" target="_blank">亚洲剧情一区二区</a>| <a href="http://www-333410.com" target="_blank">欧美成人精精品一区二区频</a>| <a href="http://caobenfan1891.com" target="_blank">国产在线高清精品</a>| <a href="http://my88855.com" target="_blank">性欧美精品高清</a>| <a href="http://008528.com" target="_blank">99精品久久</a>| <a href="http://esdzu.com" target="_blank">日韩性生活视频</a>| <a href="http://x2b2.com" target="_blank">欧美风情在线</a>| <a href="http://66jj99.com" target="_blank">午夜精品一区二区三区在线视</a>| <a href="http://tk263.com" target="_blank">欧美日韩国产在线一区</a>| <a href="http://by777117.com" target="_blank">日韩视频免费</a>| <a href="http://2424ddd.com" target="_blank">亚洲精品四区</a>| <a href="http://www49797.com" target="_blank">欧美体内谢she精2性欧美</a>| <a href="http://www72227.com" target="_blank">亚洲一二三区视频在线观看</a>| <a href="http://521nb.com" target="_blank">9国产精品视频</a>| <a href="http://www5566szy.com" target="_blank">欧美视频网址</a>| <a href="http://833816.com" target="_blank">亚洲欧美在线磁力</a>| <a href="http://www789yys.com" target="_blank">亚洲女女女同性video</a>| <a href="http://023nszz.com" target="_blank">国产精品你懂的在线</a>| <a href="http://xiehaihua.com" target="_blank">性久久久久久久久久久久</a>| <a href="http://057232.com" target="_blank">亚洲欧美综合精品久久成人</a>| <a href="http://bbbbyb.com" target="_blank">久久成人国产</a>| <a href="http://961318.com" target="_blank">另类综合日韩欧美亚洲</a>| <a href="http://metagasa.com" target="_blank">樱桃视频在线观看一区</a>| <a href="http://848585.com" target="_blank">欧美国产国产综合</a>| <a href="http://889028.com" target="_blank">欧美不卡视频一区</a>| <a href="http://kedou09.com" target="_blank">亚洲第一区在线观看</a>| <a href="http://joy-learn.com" target="_blank">男同欧美伦乱</a>| <a href="http://ycgg008.com" target="_blank">欧美精品久久99</a>| <a href="http://xingda-sh.com" target="_blank">亚洲视频欧美视频</a>| <a href="http://8842aa.com" target="_blank">在线综合+亚洲+欧美中文字幕</a>| <a href="http://avicpharm.com" target="_blank">国产精品av久久久久久麻豆网</a>| <a href="http://www-787333.com" target="_blank">国产精品99久久久久久宅男</a>| <a href="http://xxxx48.com" target="_blank">亚洲小少妇裸体bbw</a>| <a href="http://345fz.com " target="_blank">国产欧美另类</a>| <a href="http://www-tk3333.com" target="_blank">欧美wwwwww</a>| <a href="http://erodasy.com" target="_blank">亚洲在线免费观看</a>| <a href="http://689992.com" target="_blank">狠狠久久五月精品中文字幕</a>| <a href="http://038226.com" target="_blank">欧美成人伊人久久综合网</a>| <a href="http://cz-sensor.com" target="_blank">欧美成人亚洲成人日韩成人</a>| <a href="http://holotu.com" target="_blank">亚洲午夜黄色</a>| <a href="http://995688.com" target="_blank">欧美一级午夜免费电影</a>| <a href="http://86311ib.com" target="_blank">亚洲电影欧美电影有声小说</a>| <a href="http://gelaimeiwedding.com" target="_blank">亚洲黑丝在线</a>| <a href="http://muwendada.com" target="_blank">国产精品日韩电影</a>| <a href="http://bx989.com" target="_blank">国产一区二区三区不卡在线观看</a>| <a href="http://gzw33.com" target="_blank">欧美不卡高清</a>| <a href="http://www24668.com" target="_blank">国产精品v欧美精品∨日韩</a>| <a href="http://heyzo1031.com" target="_blank">久久aⅴ国产紧身牛仔裤</a>| <a href="http://tuiliqi.com" target="_blank">久久久久久久高潮</a>| <a href="http://743627.com" target="_blank">亚洲视频在线观看视频</a>| <a href="http://sao320.com" target="_blank">欧美一级艳片视频免费观看</a>| <a href="http://613609.com" target="_blank">亚洲人成网站影音先锋播放</a>| <a href="http://ylnnc.com" target="_blank">亚洲——在线</a>| <a href="http://maokk88.com" target="_blank">亚洲精一区二区三区</a>| <a href="http://dehuabz.com" target="_blank">亚洲欧美日韩国产成人精品影院</a>| <a href="http://nxhjzddata.com" target="_blank">亚洲观看高清完整版在线观看</a>| <a href="http://ahhyez.com" target="_blank">亚洲视频日本</a>| <a href="http://mide776.com" target="_blank">亚洲欧洲综合</a>| <a href="http://zgztby.com" target="_blank">欧美在线亚洲一区</a>| <a href="http://710557.com" target="_blank">亚洲图中文字幕</a>| <a href="http://3c3c3c.com" target="_blank">久久久久久久97</a>| <a href="http://wansilv.com" target="_blank">午夜激情综合网</a>| <a href="http://caox8.com" target="_blank">欧美成人一品</a>| <a href="http://xiuren2021.com" target="_blank">噜噜噜噜噜久久久久久91</a>| <a href="http://ssis378.com" target="_blank">国产精品99免视看9</a>| <a href="http://wwwmiya118.com" target="_blank">欧美激情亚洲综合一区</a>| <a href="http://5yy6.com" target="_blank">韩国v欧美v日本v亚洲v</a>| <a href="http://987gqb.com" target="_blank">亚洲视频网在线直播</a>| <a href="http://9931111.com" target="_blank">亚洲精品久久久久久久久久久久久 </a>| <a href="http://www-236677.com" target="_blank">久久性天堂网</a>| <a href="http://qq6699.com" target="_blank">亚洲午夜久久久久久久久电影网</a>| <a href="http://2061375.com" target="_blank">久久国产日韩欧美</a>| <a href="http://xianqyd.com" target="_blank">亚洲专区一二三</a>| <a href="http://z10669.com" target="_blank">欧美高清在线视频</a>| <a href="http://jiangnanmm.com" target="_blank">久久人体大胆视频</a>| <a href="http://qqszdq.com" target="_blank">国产精品毛片一区二区三区</a>| <a href="http://haoa009.com" target="_blank">欧美在线观看网站</a>| <a href="http://pgpg520.com" target="_blank">国产精品成人国产乱一区</a>| <a href="http://www90aaa.com" target="_blank">亚洲美女黄网</a>| <a href="http://xhs1039.com" target="_blank">久久精品人人做人人综合 </a>| <a href="http://91ypp.com" target="_blank">亚洲激情成人网</a>| <a href="http://114mz.com" target="_blank">久久精品国产77777蜜臀</a>| <a href="http://8xv0.com" target="_blank">欧美一区二区女人</a>| <a href="http://my8823.com" target="_blank">欧美午夜片欧美片在线观看</a>| <a href="http://132653.com" target="_blank">亚洲黄一区二区三区</a>| <a href="http://283575.com" target="_blank">亚洲国产成人精品女人久久久</a>| <a href="http://dahuxu.com" target="_blank">欧美一区二区高清</a>| <a href="http://yada-jg.com" target="_blank">久久精品2019中文字幕</a>| <a href="http://bosengame.com" target="_blank">国产精品永久入口久久久</a>| <a href="http://bgdete.com" target="_blank">亚洲视频一区在线观看</a>| <a href="http://7555hh.com" target="_blank">中文亚洲视频在线</a>| <a href="http://wwwby2232.com" target="_blank">欧美日韩午夜精品</a>| <a href="http://977764.com" target="_blank">亚洲精品久久久久</a>| <a href="http://huxiu123.com" target="_blank">亚洲黄色天堂</a>| <a href="http://eshop999.com" target="_blank">欧美大片va欧美在线播放</a>| <a href="http://687989.com" target="_blank">亚洲第一精品夜夜躁人人爽</a>| <a href="http://eee104.com" target="_blank">亚洲国产精品一区二区www</a>| <a href="http://www-4890.com" target="_blank">久久婷婷国产综合国色天香</a>| <a href="http://378682.com" target="_blank">美国成人直播</a>| <a href="http://488089.com" target="_blank">最新国产の精品合集bt伙计</a>| <a href="http://862323.com" target="_blank">男人的天堂成人在线</a>| <a href="http://jsydjxgs.com" target="_blank">亚洲福利视频专区</a>| <a href="http://quoviajes.com" target="_blank">日韩特黄影片</a>| <a href="http://www218999.com" target="_blank">欧美日韩综合另类</a>| <a href="http://32666066.com" target="_blank">亚洲视频1区2区</a>| <a href="http://2235e.com" target="_blank">欧美中文字幕</a>| <a href="http://spyfaw.com" target="_blank">伊人色综合久久天天五月婷</a>| <a href="http://cdcpt.com" target="_blank">麻豆免费精品视频</a>| <a href="http://kittybob.com" target="_blank">91久久夜色精品国产网站</a>| <a href="http://www-44469.com" target="_blank">9l国产精品久久久久麻豆</a>| <a href="http://aqd072.com" target="_blank">欧美日韩极品在线观看一区</a>| <a href="http://bckxy.com" target="_blank">宅男精品视频</a>| <a href="http://aijiaoji.com" target="_blank">久久久久久日产精品</a>| <a href="http://889028.com" target="_blank">亚洲福利视频二区</a>| <a href="http://tingxihuan.com" target="_blank">欧美精品七区</a>| <a href="http://www-5888c.com" target="_blank">亚洲综合欧美</a>| <a href="http://baoyu1313.com" target="_blank">欧美 日韩 国产一区二区在线视频 </a>| <a href="http://zgslwtc.com" target="_blank">欧美激情第10页</a>| <a href="http://hjersqc.com" target="_blank">99爱精品视频</a>| <a href="http://smdzs.com" target="_blank">久久黄色级2电影</a>| <a href="http://www-4564949.com" target="_blank">亚洲福利电影</a>| <a href="http://857sds.com" target="_blank">欧美体内谢she精2性欧美</a>| <a href="http://ydpszcn.com" target="_blank">午夜一区在线</a>| <a href="http://fuqiba.com" target="_blank">亚洲风情亚aⅴ在线发布</a>| <a href="http://zz9876.com" target="_blank">亚洲一二区在线</a>| <a href="http://9kkkb.com" target="_blank">影音先锋久久精品</a>| <a href="http://tutu80.com" target="_blank">欧美日韩另类综合</a>| <a href="http://gelaimeiwedding.com" target="_blank">久久成人这里只有精品</a>| <a href="http://cz-sensor.com" target="_blank">亚洲黄色高清</a>| <a href="http://toomicsvip.com" target="_blank">久久精品av麻豆的观看方式 </a>| <a href="http://89wbw.com" target="_blank">久热精品视频在线观看一区</a>| <a href="http://e7w2.com" target="_blank">亚洲精品国产欧美</a>| <a href="http://788997.com" target="_blank">国产日韩欧美精品一区</a>| <a href="http://xiaocao-av.com" target="_blank">欧美韩日视频</a>| <a href="http://caobenfan1891.com" target="_blank">欧美一区二区视频在线观看</a>| <a href="http://j88866.com" target="_blank">亚洲剧情一区二区</a>| <a href="http://chengli88.com" target="_blank">伊人春色精品</a>| <a href="http://378682.com" target="_blank">亚洲成人自拍视频</a>| <a href="http://www19829.com" target="_blank">久久精品一区四区</a>| <a href="http://zhengnuoxin.com" target="_blank">亚洲风情亚aⅴ在线发布</a>| <a href="http://123086.com" target="_blank">欧美jjzz</a>| <a href="http://nvpuow.com" target="_blank">欧美有码在线观看视频</a>| <a href="http://luqintang.com" target="_blank">亚洲人成在线播放</a>| <a href="http://erodasy.com" target="_blank">久久一区二区三区超碰国产精品</a>| <a href="http://02326a.com" target="_blank">亚洲视频播放</a>| <a href="http://990288.com" target="_blank">亚洲欧洲午夜</a>| <a href="http://216667.com" target="_blank">国产一区二区三区不卡在线观看</a>| <a href="http://wallypanel.com" target="_blank">欧美激情一区二区三区在线视频 </a>| <a href="http://rainbowbpm.com" target="_blank">六十路精品视频</a>| <a href="http://tzhbsb.com" target="_blank">日韩一区二区精品</a>| <a href="http://868482.com" target="_blank">免费成人小视频</a>| <a href="http://avsemm.com" target="_blank">欧美一区二区在线视频</a>| <a href="http://fs-nanxiang.com" target="_blank">亚洲久色影视</a>| <a href="http://72avav.com" target="_blank">国产午夜精品一区二区三区欧美</a>| <a href="http://essuee.com" target="_blank">欧美日韩免费网站</a>| <a href="http://cdcpt.com" target="_blank">久久精品91久久久久久再现</a>| <a href="http://wwwbbb888999.com" target="_blank">91久久久在线</a>| <a href="http://qqx123.com" target="_blank">亚洲国产欧美另类丝袜</a>| <a href="http://9911444.com" target="_blank">欧美在线一二三区</a>| <a href="http://www-067.com" target="_blank">一本久久综合</a>| <a href="http://zztto7.com" target="_blank">国产精品国产三级国产普通话99</a>| <a href="http://850cn.com" target="_blank">欧美高清在线播放</a>| <a href="http://zzzz80.com" target="_blank">欧美在线一二三四区</a>| <a href="http://lutube666.com" target="_blank">日韩一级在线观看</a>| <a href="http://www-188444.com" target="_blank">久久成人精品无人区</a>| <a href="http://seanzhau.com" target="_blank">亚洲欧美成人一区二区在线电影</a>| <a href="http://ibenbio.com" target="_blank">午夜精品久久久久</a>| <a href="http://1397979.com" target="_blank">欧美在现视频</a>| <a href="http://jiarenlady.com" target="_blank">小处雏高清一区二区三区</a>| <a href="http://ybshg.com" target="_blank">亚洲国产一成人久久精品</a>| <a href="http://bgflee.com" target="_blank">国产欧美精品日韩区二区麻豆天美 </a>| <a href="http://dfrllaser.com" target="_blank">亚洲影院免费观看</a>| <a href="http://cn1898.com" target="_blank">欧美私人啪啪vps</a>| <a href="http://www068hs.com" target="_blank">欧美电影资源</a>| <a href="http://huangsedy.com" target="_blank">尤物yw午夜国产精品视频</a>| <a href="http://aqdw2021.com" target="_blank">欧美三级电影大全</a>| <a href="http://ccly2.com" target="_blank">女女同性精品视频</a>| <a href="http://woniuminsu.com" target="_blank">久久国产精品久久久久久电车</a>| <a href="http://9658888.com" target="_blank">亚洲最新中文字幕</a>| <a href="http://zhijiasd.com" target="_blank">亚洲国产精品热久久</a>| <a href="http://668756.com" target="_blank">女同性一区二区三区人了人一</a>| <a href="http://y3u7.com" target="_blank">狂野欧美激情性xxxx</a>| <a href="http://syfeichi.com" target="_blank">久久本道综合色狠狠五月</a>| <a href="http://hgx123.com" target="_blank">亚洲免费网址</a>| <a href="http://bjrailtech.com" target="_blank">欧美图区在线视频</a>| <a href="http://457745.com" target="_blank">国产精品jizz在线观看美国 </a>| <a href="http://221080.com" target="_blank">欧美日韩精品福利</a>| <a href="http://toomicsvip.com" target="_blank">欧美不卡三区</a>| <a href="http://www333393.com" target="_blank">免播放器亚洲</a>| <a href="http://www1982t.com" target="_blank">欧美成人免费在线</a>| <a href="http://036762.com" target="_blank">欧美成人综合</a>| <a href="http://www72227.com" target="_blank">欧美高清视频</a>| <a href="http://jivbus.com" target="_blank">欧美一区亚洲一区</a>| <a href="http://wwwhhh396.com" target="_blank">麻豆精品传媒视频</a>| <a href="http://www-132377.com" target="_blank">久久亚洲春色中文字幕久久久</a>| <a href="http://042225.com" target="_blank">久久精品最新地址</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>