锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品无码久久久秋霞2,久久66热人妻偷产精品9,国内精品久久国产大陆http://www.shnenglu.com/shyli/category/1232.htmlC++涔嬫ⅵzh-cnThu, 22 May 2008 17:34:14 GMTThu, 22 May 2008 17:34:14 GMT60pow鍑芥暟鐨勬ц兘嫻嬭瘯http://www.shnenglu.com/shyli/archive/2007/08/25/30823.htmlbeyonlinbeyonlinSat, 25 Aug 2007 12:16:00 GMThttp://www.shnenglu.com/shyli/archive/2007/08/25/30823.htmlhttp://www.shnenglu.com/shyli/comments/30823.htmlhttp://www.shnenglu.com/shyli/archive/2007/08/25/30823.html#Feedback2http://www.shnenglu.com/shyli/comments/commentRss/30823.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/30823.html鏄ㄥぉ鍦≒KU涓婂仛浜嗕竴棰?a >2187錛岄檺鏃?s銆?br>綆楁硶涓昏鑰楁椂鍦ㄥ嬈℃眰涓嶅悓鏁存暟鐨勫鉤鏂廣?br>褰撶敤pow鍑芥暟姹傛椂錛岃秴鏃訛紱
鑰岀洿鎺ヤ箻鎵?32ms銆?br>鐩稿樊涔熷お澶т簡鍚с?br>浜庢槸灝卞啓浜嗕竴孌典唬鐮佹潵嫻嬭瘯pow鐨勬ц兘
棣栧厛浜х敓10000涓殢鏈烘暣鏁幫紝鐒跺悗閲嶅1000嬈℃眰鏁存暟鐨勫鉤鏂?/p>
#include <iostream>
#include 
<cmath>
#include 
<ctime>
using 
namespace std;
const int MAX = 10000;
int a[MAX];
int main()
{
    
int i, j, n = MAX;
    
int rep = 1000//閲嶅嬈℃暟
    clock_t beg, 
end;
    
for(i = 0; i < n; i++)
        a[i] 
= rand() % 20000 - 10000//-10000 <= a[i]< 10000

    cout
<<"test a[i]*a[i]"<<endl;
    beg 
= clock();
    
for(j = 0; j < rep; j++)
        
for(i = 0; i < n; i++)
            a[i] 
* a[i];
    
end = clock();
    cout
<<"time: "<<end - beg<<"ms"<<endl;
    
    cout
<<"test pow(a[i], 2.0)"<<endl;
    beg 
= clock();
    
for(j = 0; j < rep; j++)
        
for(i = 0; i < n; i++)
            pow(a[i], 
2.0);
    
end = clock();
    cout
<<"time: "<<end - beg<<"ms"<<endl;

    
return 0;
}

涓嬮潰鏄祴璇曠粨鏋滐細

test a[i]*a[i]
time: 31ms
test pow(a[i], 2.0)
time: 2828ms

鎵浠ヤ笅嬈¢亣鍒扮被浼兼儏鍐典笉鍐嶇敤pow鍑芥暟浜?#8230;…

beyonlin 2007-08-25 20:16 鍙戣〃璇勮
]]>
涓閬撶畻娉曢寮曞彂鐨勫姩鎬佸唴瀛樼鐞嗙殑鎬濊?/title><link>http://www.shnenglu.com/shyli/archive/2007/08/13/29853.html</link><dc:creator>beyonlin</dc:creator><author>beyonlin</author><pubDate>Sun, 12 Aug 2007 16:29:00 GMT</pubDate><guid>http://www.shnenglu.com/shyli/archive/2007/08/13/29853.html</guid><wfw:comment>http://www.shnenglu.com/shyli/comments/29853.html</wfw:comment><comments>http://www.shnenglu.com/shyli/archive/2007/08/13/29853.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/shyli/comments/commentRss/29853.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/shyli/services/trackbacks/29853.html</trackback:ping><description><![CDATA[<p>鍦ㄥ仛<a >PKU2762</a>鏃訛紝闇瑕佸緩閭繪帴琛ㄣ?br>浜庢槸鎸夐儴灝辯彮鍐欎簡涓嬮潰涓涓彃鍏ヨ竟鍒伴偦鎺ヨ〃涓殑鍑芥暟錛?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> VMAX </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1010</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">typedef struct Graph<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> vex;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    Graph</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">next</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">}Graph;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">Graph ArcGraph[VMAX];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">void insert(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> u, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> v)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    Graph</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> t </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Graph;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    Graph</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> p </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ArcGraph[u].next;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    t</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">vex </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> v;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    t</span><span style="COLOR: #000000">-></span><span style="COLOR: #0000ff">next</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> p;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    ArcGraph[u].next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> t;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">}</span></div> <p><br>瀹屾垚瀹屾暣鐨勭▼搴忔彁浜や笂鍘伙紝寰楀埌緇撴灉<br>Memory:25796K  Time:375MS<br>Language:C++  Result:Accepted<br><br>鍐嶅姣斿埆浜虹殑紼嬪簭<br>Memory:296K Time:109MS<br><br>鏃犺鏄椂闂磋繕鏄┖闂撮兘鐩稿樊寰堝ぇ銆?br>浜庢槸灝辮冭檻鎬庝箞浼樺寲鑷繁鐨勭▼搴忋?br>絎竴涓棶棰橈細瑙勬ā鍙湁1000錛屼負浠涔堜細鐢ㄩ偅涔堝鍐呭瓨鍛紵<br>浠旂粏涓鎯蟲暟鎹槸澶歝ase鐨勶紝姣忔鎻掑叆鏂拌妭鐐規椂閮借鍔ㄦ佸垱寤轟竴涓妭鐐廣?br>涓鏉ュ姩鎬佸垱寤鴻楁椂闂達紝浜屾潵姣忎釜case緇撴潫鐨勯偦鎺ヨ〃涓殑鑺傜偣娌℃湁閲婃斁錛屾晠鑰楄垂澶ч噺鍐呭瓨銆?br>鐒跺悗灝辨兂鍒頒簡涓嬮潰鐨勭畻娉曪紝棣栧厛鍒濆鍖栦竴鍧楀唴瀛楪raph use[100*VMAX];榪欐牱姣忔闇瑕佹柊鑺傜偣鏃訛紝<br>灝變粠use涓幏鍙栥傚鏋渦se浣跨敤瀹屾瘯灝卞啀鍔ㄦ佸垱寤恒?br><br>渚濇綆楁硶浼樺寲鍚庯紝寰楀埌鐨勭粨鏋滄瘮杈冩弧鎰?br>Memory:1000K  Time:218MS<br>Language:C++  Result:Accepted</p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"><span style="COLOR: #0000ff">const</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> VMAX </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">1010</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">typedef struct Graph<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> vex;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    Graph</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">next</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">}Graph;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">Graph ArcGraph[VMAX];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">Graph use[</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">VMAX];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> size </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">void insert(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> u, </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> v)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    Graph</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> t;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(size </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">VMAX)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    {<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        t </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">use[size];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        size</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    }<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> t </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Graph;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    Graph</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> p </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ArcGraph[u].next;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    t</span><span style="COLOR: #000000">-></span><span style="COLOR: #000000">vex </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> v;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    t</span><span style="COLOR: #000000">-></span><span style="COLOR: #0000ff">next</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> p;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    ArcGraph[u].next </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> t;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">}</span></div> <img src ="http://www.shnenglu.com/shyli/aggbug/29853.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/shyli/" target="_blank">beyonlin</a> 2007-08-13 00:29 <a href="http://www.shnenglu.com/shyli/archive/2007/08/13/29853.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>絳涙硶姹傜礌鏁?/title><link>http://www.shnenglu.com/shyli/archive/2007/05/18/24334.html</link><dc:creator>beyonlin</dc:creator><author>beyonlin</author><pubDate>Fri, 18 May 2007 08:13:00 GMT</pubDate><guid>http://www.shnenglu.com/shyli/archive/2007/05/18/24334.html</guid><wfw:comment>http://www.shnenglu.com/shyli/comments/24334.html</wfw:comment><comments>http://www.shnenglu.com/shyli/archive/2007/05/18/24334.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/shyli/comments/commentRss/24334.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/shyli/services/trackbacks/24334.html</trackback:ping><description><![CDATA[<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee" twffan="done"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"><span style="COLOR: #000000" twffan="done">#include</span><span style="COLOR: #000000" twffan="done"><</span><span style="COLOR: #000000" twffan="done">iostream</span><span style="COLOR: #000000" twffan="done">></span><span style="COLOR: #000000" twffan="done"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">using namespace std;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"></span><span style="COLOR: #0000ff" twffan="done">const</span><span style="COLOR: #000000" twffan="done"> </span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> MAXV </span><span style="COLOR: #000000" twffan="done">=</span><span style="COLOR: #000000" twffan="done"> </span><span style="COLOR: #000000" twffan="done">10000</span><span style="COLOR: #000000" twffan="done">; </span><span style="COLOR: #000000" twffan="done">//</span><span style="COLOR: #000000" twffan="done">绱犳暟琛ㄨ寖鍥?br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">bool flag[MAXV</span><span style="COLOR: #000000" twffan="done">+</span><span style="COLOR: #000000" twffan="done">1</span><span style="COLOR: #000000" twffan="done">]; </span><span style="COLOR: #000000" twffan="done">//</span><span style="COLOR: #000000" twffan="done">鏍囧織涓涓暟鏄惁涓虹礌鏁?br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"></span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> prime[MAXV</span><span style="COLOR: #000000" twffan="done">+</span><span style="COLOR: #000000" twffan="done">1</span><span style="COLOR: #000000" twffan="done">]; </span><span style="COLOR: #000000" twffan="done">//</span><span style="COLOR: #000000" twffan="done">绱犳暟琛?涓嬫爣浠?寮濮?br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"></span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> size; </span><span style="COLOR: #000000" twffan="done">//</span><span style="COLOR: #000000" twffan="done">绱犳暟涓暟<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">void genPrime(</span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> max)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    memset(flag, </span><span style="COLOR: #0000ff" twffan="done">true</span><span style="COLOR: #000000" twffan="done">, sizeof(flag));<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    </span><span style="COLOR: #0000ff" twffan="done">for</span><span style="COLOR: #000000" twffan="done">(</span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> i </span><span style="COLOR: #000000" twffan="done">=</span><span style="COLOR: #000000" twffan="done"> </span><span style="COLOR: #000000" twffan="done">2</span><span style="COLOR: #000000" twffan="done">; i </span><span style="COLOR: #000000" twffan="done"><=</span><span style="COLOR: #000000" twffan="done"> max </span><span style="COLOR: #000000" twffan="done">/</span><span style="COLOR: #000000" twffan="done"> </span><span style="COLOR: #000000" twffan="done">2</span><span style="COLOR: #000000" twffan="done">; i</span><span style="COLOR: #000000" twffan="done">++</span><span style="COLOR: #000000" twffan="done">)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    {<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        </span><span style="COLOR: #0000ff" twffan="done">if</span><span style="COLOR: #000000" twffan="done">(flag[i])<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        {<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">            </span><span style="COLOR: #0000ff" twffan="done">for</span><span style="COLOR: #000000" twffan="done">(</span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> j </span><span style="COLOR: #000000" twffan="done">=</span><span style="COLOR: #000000" twffan="done"> i </span><span style="COLOR: #000000" twffan="done"><<</span><span style="COLOR: #000000" twffan="done"> </span><span style="COLOR: #000000" twffan="done">1</span><span style="COLOR: #000000" twffan="done"> ; j </span><span style="COLOR: #000000" twffan="done"><=</span><span style="COLOR: #000000" twffan="done"> max; j </span><span style="COLOR: #000000" twffan="done">+=</span><span style="COLOR: #000000" twffan="done"> i)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">            {<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">                flag[j] </span><span style="COLOR: #000000" twffan="done">=</span><span style="COLOR: #000000" twffan="done"> </span><span style="COLOR: #0000ff" twffan="done">false</span><span style="COLOR: #000000" twffan="done">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">            }<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        }<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    }<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    </span><span style="COLOR: #0000ff" twffan="done">for</span><span style="COLOR: #000000" twffan="done">(</span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> i </span><span style="COLOR: #000000" twffan="done">=</span><span style="COLOR: #000000" twffan="done"> </span><span style="COLOR: #000000" twffan="done">2</span><span style="COLOR: #000000" twffan="done"> ; i </span><span style="COLOR: #000000" twffan="done"><=</span><span style="COLOR: #000000" twffan="done"> max; i</span><span style="COLOR: #000000" twffan="done">++</span><span style="COLOR: #000000" twffan="done">)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    {<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        </span><span style="COLOR: #0000ff" twffan="done">if</span><span style="COLOR: #000000" twffan="done">(flag[i])<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        {<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">            prime[size</span><span style="COLOR: #000000" twffan="done">++</span><span style="COLOR: #000000" twffan="done">] </span><span style="COLOR: #000000" twffan="done">=</span><span style="COLOR: #000000" twffan="done"> i;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">        }<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    }<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">}<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"></span><span style="COLOR: #0000ff" twffan="done">int</span><span style="COLOR: #000000" twffan="done"> main()<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    genPrime(MAXV);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">    return </span><span style="COLOR: #000000" twffan="done">0</span><span style="COLOR: #000000" twffan="done">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done">}<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top twffan="done"></span></div> <img src ="http://www.shnenglu.com/shyli/aggbug/24334.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/shyli/" target="_blank">beyonlin</a> 2007-05-18 16:13 <a href="http://www.shnenglu.com/shyli/archive/2007/05/18/24334.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>瀛楃涓瞙ash鍑芥暟http://www.shnenglu.com/shyli/archive/2007/04/07/21455.htmlbeyonlinbeyonlinSat, 07 Apr 2007 08:22:00 GMThttp://www.shnenglu.com/shyli/archive/2007/04/07/21455.htmlhttp://www.shnenglu.com/shyli/comments/21455.htmlhttp://www.shnenglu.com/shyli/archive/2007/04/07/21455.html#Feedback2http://www.shnenglu.com/shyli/comments/commentRss/21455.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/21455.html鍦ㄤ笅鍒楃▼搴忎腑錛屼笉鏄寜甯歌鏂規硶鐢ㄥ搱甯岃〃鏉ヨ褰曞叧閿瓧錛?br>鑰屾槸鐢ㄦ暣鍨嬫暟緇凥table璁板綍鍏抽敭瀛楀湪瀛楃涓瞔h涓殑浣嶇疆銆?br>鍦ㄦ彃鍏ユ椂涓嶇敤鎶婂叧閿瓧澶嶅埗鍒板搱甯岃〃涓紝鍙槸璁板綍涓涓儲寮曪紝浠庤屾彁楂樹簡鏁堢巼銆?br>褰撴煡璇㈡椂錛屽彧瑕佹妸Htable鐨勫兼槧灝勫埌瀛楃涓瞔h涓氨鍙互浜嗐?br>娉ㄦ剰ch鐨勪笅鏍囪浠?寮濮嬶紝鍥犱負Htable涓殑闆跺艱涓烘槸絀猴紝澶勭悊璧鋒潵姣旇緝鏂逛究銆?
#include<iostream>
#include
<string>
using 
namespace std;
const int MAXN = 9973//鍝堝笇琛ㄩ暱搴?br>const int len = 30//瀛楃涓茬殑鏈澶ч暱搴?br>int Htable[MAX];
char ch[MAX][len]; //瀛樺偍鍏抽敭瀛楃殑瀛楃涓?br>unsigned long Hash(char * key)
{
    unsigned 
long h = 0;
    
while(*key)
    {
        h 
= (h << 4+ *key++;
        unsigned 
long g = h & 0xf0000000L;
        
if(g)
            h 
^= g >> 24;
        h 
&= ~g;
    }
    
return h % MAX;
}
int search(char * key)
{
    unsigned 
long i = Hash(key);
    
while(Htable[i])
    {
        
if(strcmp(ch[Htable[i]], key) == 0)
            
return i;
        i 
= (i + 1) % MAX;
    }
    
return -1;
}
int insert(char * key, int j) //j涓哄叧閿瓧鍦╟h涓殑浣嶇疆錛屽嵆绱㈠紩
{
    unsigned 
long i = Hash(key);
    
while(Htable[i])
        i 
= (i + 1) % MAX;
    Htable[i] 
= j;
    
return i;
}


beyonlin 2007-04-07 16:22 鍙戣〃璇勮
]]>
鎻掑叆鎺掑簭娉涘瀷綆楁硶http://www.shnenglu.com/shyli/archive/2007/02/06/18485.htmlbeyonlinbeyonlinTue, 06 Feb 2007 11:13:00 GMThttp://www.shnenglu.com/shyli/archive/2007/02/06/18485.htmlhttp://www.shnenglu.com/shyli/comments/18485.htmlhttp://www.shnenglu.com/shyli/archive/2007/02/06/18485.html#Feedback3http://www.shnenglu.com/shyli/comments/commentRss/18485.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/18485.htmltemplate <typename Iter> void insertSort(Iter *begin, Iter *end) { for(Iter *it = begin + 1; it != end; it++) { Iter tmp = *it; Iter *it2 = it - 1; while(it2 > begin - 1 && *it2 > tmp) { *(it2 + 1) = *it2; it2 --; } *(it2 + 1) = tmp; } }

beyonlin 2007-02-06 19:13 鍙戣〃璇勮
]]>
鏈澶у尮閰嶅寛鐗欏埄綆楁硶http://www.shnenglu.com/shyli/archive/2006/10/24/14096.htmlbeyonlinbeyonlinTue, 24 Oct 2006 10:34:00 GMThttp://www.shnenglu.com/shyli/archive/2006/10/24/14096.htmlhttp://www.shnenglu.com/shyli/comments/14096.htmlhttp://www.shnenglu.com/shyli/archive/2006/10/24/14096.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/14096.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/14096.html#include<cstdio> #include<memory> using namespace std; const int MAX = 10001; bool map[MAX][MAX],visit[MAX]; int match[MAX]; int a, b; bool DFS(int i) { int j, k = 1; for(j = 1 ; j <= b; j++) { if(map[i][j] && !visit[j]) { visit[j] = true; k = match[j]; match[j] = i; if(k == 0 || DFS(k)) return true; match[j] = k; } } return false; } int Hungary() { int j, ans = 0; memset(match, 0, sizeof(match)); for(j = 1; j <= a; j++) { memset(visit,false, sizeof(visit)); if(DFS(j)) ans++; } return ans; } int main() { int i, j, n,ans; memset(map,false,sizeof(map)); scanf("%d%d",&a,&b); ans = Hungary(); printf("%d\n",ans); return 0; }

beyonlin 2006-10-24 18:34 鍙戣〃璇勮
]]>
鏈灝忕敓鎴愭爲Prim綆楁硶http://www.shnenglu.com/shyli/archive/2006/10/13/13658.htmlbeyonlinbeyonlinFri, 13 Oct 2006 15:48:00 GMThttp://www.shnenglu.com/shyli/archive/2006/10/13/13658.htmlhttp://www.shnenglu.com/shyli/comments/13658.htmlhttp://www.shnenglu.com/shyli/archive/2006/10/13/13658.html#Feedback2http://www.shnenglu.com/shyli/comments/commentRss/13658.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/13658.html#include<cstdio> const int MAX = 10000; const int INF = 1000000; int clo[MAX]; int low[MAX]; int c[MAX][MAX]; bool flag[MAX]; int beg[MAX],end[MAX];//璁板綍鐢熸垚鏍戠殑姣忔潯杈圭殑涓や釜欏剁偣 int Prim(int n) { int i, j, k, ans = 0, pair = 0; flag[1] = true; for(i = 2; i <= n; i++) { low[i] = c[1][i]; clo[i] = 1; flag[i] = false; } for(i = 1; i < n; i++) { j = 1; int min = INF; for(k = 2; k <=n; k++) { if(low[k] < min && !flag[k]) { min = low[k]; j = k; } } flag[j] = true; beg[i] = j; end[i] = clo[j]; ans += c[j][clo[j]]; for(k = 2; k <= n; k++) { if(c[j][k] < low[k] && !flag[k]) { low[k] = c[j][k]; clo[k] = j; } } } return ans; } int main() { int i, j, n, m; scanf("%d%d",&n,&m); for(i = 1; i <= n; i++) { for(j = 1; j <=n; j++) { c[i][j]=INF; } } return 0; }

beyonlin 2006-10-13 23:48 鍙戣〃璇勮
]]>
itoa鍑芥暟http://www.shnenglu.com/shyli/archive/2006/10/12/13588.htmlbeyonlinbeyonlinWed, 11 Oct 2006 16:59:00 GMThttp://www.shnenglu.com/shyli/archive/2006/10/12/13588.htmlhttp://www.shnenglu.com/shyli/comments/13588.htmlhttp://www.shnenglu.com/shyli/archive/2006/10/12/13588.html#Feedback6http://www.shnenglu.com/shyli/comments/commentRss/13588.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/13588.html#include<cstdlib>
#include<cstdio>
int main() { int num = 10; char str[100]; itoa(num, str, 2); printf("%s\n", str); return 0; }itoa()鍑芥暟鏈?涓弬鏁幫細絎竴涓弬鏁版槸瑕佽漿鎹㈢殑鏁板瓧錛岀浜屼釜鍙傛暟鏄洰鏍囧瓧絎︿覆錛岀涓変釜鍙傛暟鏄漿縐繪暟瀛楁椂鎵鐢?鐨勫熀鏁般傚湪涓婁緥涓紝杞崲鍩烘暟涓?0銆?0錛氬崄榪涘埗錛?錛氫簩榪涘埗鈥︹?br />浜庢槸鎯沖埌浜嗕竴涓崄榪涘埗杞簩榪涘埗鐨勬柟娉曪細
#include<cstdlib>
#include<cstdio>
int main() { int num = 10; char str[100]; int n = atoi(itoa(num, str, 2)); printf("%d\n",n); return 0; }
鍏堟妸num杞崲涓轟簩榪涘埗鐨勫瓧絎︿覆錛屽啀鎶婅瀛楃涓茶漿鎹負鏁存暟銆?/pre>

beyonlin 2006-10-12 00:59 鍙戣〃璇勮
]]>褰掑茍鎺掑簭姹傞嗗簭鏁?/title><link>http://www.shnenglu.com/shyli/archive/2006/10/11/13553.html</link><dc:creator>beyonlin</dc:creator><author>beyonlin</author><pubDate>Tue, 10 Oct 2006 16:27:00 GMT</pubDate><guid>http://www.shnenglu.com/shyli/archive/2006/10/11/13553.html</guid><wfw:comment>http://www.shnenglu.com/shyli/comments/13553.html</wfw:comment><comments>http://www.shnenglu.com/shyli/archive/2006/10/11/13553.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/shyli/comments/commentRss/13553.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/shyli/services/trackbacks/13553.html</trackback:ping><description><![CDATA[ <pre>杞嚜錛?a >http://www.blog.edu.cn/user2/sempr/archives/2006/1142716.shtml</a><br />#include<cstdio> <br />const int MAX = 10000; int a[MAX],b[MAX]; int change; void merge(int p, int q, int r) { int i, j = 0; int begA = p, endA = q, begB = q+1, endB = r; while(begA <= endA && begB <= endB) { if(a[begA] <= a[begB]) b[j++] = a[begA++]; else { b[j++] = a[begB++]; change += q - begA + 1; } } while(begA <= endA) b[j++] = a[begA++]; while(begB <= endB) b[j++] = a[begB++]; for(i = 0; i < j; i++) a[p+i] = b[i]; } void mergeSort(int first, int last) { if(first < last) { int mid = (first + last) / 2; mergeSort(first, mid); mergeSort(mid+1, last); merge(first, mid, last); } } int main() { return 0; } </pre> <img src ="http://www.shnenglu.com/shyli/aggbug/13553.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/shyli/" target="_blank">beyonlin</a> 2006-10-11 00:27 <a href="http://www.shnenglu.com/shyli/archive/2006/10/11/13553.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍗曟簮鏈鐭礬寰凞ijkstra綆楁硶http://www.shnenglu.com/shyli/archive/2006/10/10/13506.htmlbeyonlinbeyonlinMon, 09 Oct 2006 16:22:00 GMThttp://www.shnenglu.com/shyli/archive/2006/10/10/13506.htmlhttp://www.shnenglu.com/shyli/comments/13506.htmlhttp://www.shnenglu.com/shyli/archive/2006/10/10/13506.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/13506.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/13506.htmlc[i][j]涓鴻竟<i,j>鐨勬潈銆?br />濡傛灉杈?lt;i,j>涓嶅瓨鍦紝鍒欑疆c[i][j]=INF銆?br />path[i]鐢ㄦ潵淇濆瓨鏈鐭礬寰勪腑鐐筰鐨勫墠涓涓《鐐廣?br />
#include<cstdio>
const int MAX = 10000;
const int INF = 1000000;
int d[MAX];
int c[MAX][MAX];
bool flag[MAX];
//int path[MAX];
int Dijkstra(int beg, int n)
{
	int i, j, u, tmp;
	for(i = 1; i <= n; i++)
	{
		d[i] = c[beg][i];
		flag[i] = false;
		/*if(d[i] == INF)
			path[i] = 0;
		else
			path[i] = beg;*/
	}
	d[beg] = 0; flag[beg] = true;
	for(i = 1; i <= n; i++)
	{
		tmp = INF; u = beg;
		for(j = 1; j <=n; j++)
		{
			if(!flag[j] && d[j] < tmp)
			{
				u = j; 
				tmp = d[j];
			}
		}
		flag[u] = true;
		for(j  = 1; j <= n; j++)
		{
			if(!flag[j] && c[u][j] < INF)
			{
				if(d[u] + c[u][j] < d[j])
					d[j] = d[u] + c[u][j];
				//path[j] = u;
			}
		}
	}
	return 0;
}
int main()
{	
	return 0;
}


beyonlin 2006-10-10 00:22 鍙戣〃璇勮
]]>
澶氭簮鏈鐭礬寰刦loyd_warshall綆楁硶http://www.shnenglu.com/shyli/archive/2006/10/09/13473.htmlbeyonlinbeyonlinSun, 08 Oct 2006 16:15:00 GMThttp://www.shnenglu.com/shyli/archive/2006/10/09/13473.htmlhttp://www.shnenglu.com/shyli/comments/13473.htmlhttp://www.shnenglu.com/shyli/archive/2006/10/09/13473.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/13473.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/13473.html濡傛灉杈?lt;i,j>涓嶅瓨鍦紝鍒欑疆d[i][j]涓篒NF銆?br />
#include<cstdio>
const int MAX=10000; const int INF=1000000; int d[MAX][MAX]; int floyd (int n) { for(int k =1 ; k <= n; k++) { for(int i = 1; i <= n; i++) { for(int j = 1; j <= n; j++) { if(d[i][k] + d[k][j] < d[i][j]) d[i][j] = d[i][k] + d[k][j]; } } }
聽聽聽聽聽聽聽聽return 0; } int main() { return 0; } floyd鍚庯紝濡傛灉d[i][j]>=INF錛屽垯鐐筰鍒扮偣j娌℃湁璺?br />else鐐筰鍒扮偣j鐨勬渶鐭礬寰勯暱搴︿負d[i][j]銆?br />


beyonlin 2006-10-09 00:15 鍙戣〃璇勮
]]>
鏁拌----鍒ゆ柇璐ㄦ暟http://www.shnenglu.com/shyli/archive/2006/10/08/13438.htmlbeyonlinbeyonlinSat, 07 Oct 2006 16:40:00 GMThttp://www.shnenglu.com/shyli/archive/2006/10/08/13438.htmlhttp://www.shnenglu.com/shyli/comments/13438.htmlhttp://www.shnenglu.com/shyli/archive/2006/10/08/13438.html#Feedback2http://www.shnenglu.com/shyli/comments/commentRss/13438.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/13438.html鏈榪戝彂鐜拌嚜宸卞鏁拌鍑犱箮鏄竴紿嶄笉閫氥?br />鏄椂鍊欏紑濮嬪浜嗐?br />浠庨浂寮濮嬧︹?br />鍒ゆ柇涓涓暟鏄惁涓鴻川鏁幫細

bool prime(int a)
{
	for(int i=2;i<=sqrt(a);i++)
	{
		if(a%i==0)
			return false;
	}
	return true;
}


beyonlin 2006-10-08 00:40 鍙戣〃璇勮
]]>
騫舵煡闆嗙被http://www.shnenglu.com/shyli/archive/2006/08/30/11837.htmlbeyonlinbeyonlinTue, 29 Aug 2006 16:27:00 GMThttp://www.shnenglu.com/shyli/archive/2006/08/30/11837.htmlhttp://www.shnenglu.com/shyli/comments/11837.htmlhttp://www.shnenglu.com/shyli/archive/2006/08/30/11837.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/11837.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/11837.htmlhttp://www.shnenglu.com/qywyh/archive/2006/08/16/11301.html
http://www.programfan.com/blog/article.asp?id=16879

#ifndef UFSET_H
#define UFSET_H
class UFset
{
	public:
		UFset(int);
		void Union(int ,int);
		int Find(int);
		int & operator [] (int i){return parent[i];}
		int size(){return length;}
	private:
		int length;//闆嗗悎鐨勪釜鏁?
		int * parent;
};
UFset::UFset(int len)
{
	length = len;
	parent = new int [length + 1];
	for(int k = 1; k <= length; k++)
		parent[k] = -1;
}
int UFset::Find(int x)
{
	 int i;
	 for(i = x; parent[i] >= 0; i = parent[i]);//鎼滅儲鏍硅妭鐐?
	 while(i!=x)//璺緞鍘嬬緝
	 {
		  int tmp = parent[x];
		  parent[x] = i;
		  x = tmp;
	 }
	 return i;
}
void UFset::Union(int x,int y)//鍚堝茍
{
	int pX = Find(x);
	int pY = Find(y);
	if(pX != pY)
	{
		int tmp = parent[pX] + parent[pY];
		if(parent[pX] > parent[pY])
		{
			parent[pX] = pY;
			parent[pY] = tmp;
		}
		else 
		{
			parent[pY] = pX;
			parent[pX] = tmp;
		}
		length--;
	}
}
#endif


beyonlin 2006-08-30 00:27 鍙戣〃璇勮
]]>
鎴戠殑鍔ㄦ佽鍒掑惎钂欓http://www.shnenglu.com/shyli/archive/2006/08/28/11764.htmlbeyonlinbeyonlinMon, 28 Aug 2006 02:31:00 GMThttp://www.shnenglu.com/shyli/archive/2006/08/28/11764.htmlhttp://www.shnenglu.com/shyli/comments/11764.htmlhttp://www.shnenglu.com/shyli/archive/2006/08/28/11764.html#Feedback1http://www.shnenglu.com/shyli/comments/commentRss/11764.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/11764.html 鍔ㄦ佽鍒掑嵆鏄竴涓噸鐐癸紝鍙堟槸涓涓毦鐐廣?br />浠婂ぉ緇堜簬鍋氬嚭浜嗕竴棰樺儚鏍風殑鍔ㄦ佽鍒掗銆?br />Problem Id:1163聽聽User Id:beyonlin_SCUT
Memory:100K聽聽Time:0MS
Language:C++聽聽Result:Accepted
http://acm.pku.edu.cn/JudgeOnline/problem?id=1163

The Triangle
Time Limit:1000MS聽 Memory Limit:10000K
Total Submit:3415 Accepted:1988

Description

7

3 8
8 1 0
2 7 4 4
4 5 2 6 5

(Figure 1)


Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers passed on a route that starts at the top and ends somewhere on the base. Each step can go either diagonally down to the left or diagonally down to the right.

Input
Your program is to read from standard input. The first line contains one integer N: the number of rows in the triangle. The following N lines describe the data of the triangle. The number of rows in the triangle is > 1 but <= 100. The numbers in the triangle, all integers, are between 0 and 99.

Output
Your program is to write to standard output. The highest sum is written as an integer.

Sample Input

5
7
3 8
8 1 0 
2 7 4 4
4 5 2 6 5

Sample Output
30


鍒嗘瀽錛?br />棰樻剰綆鍖栦負錛?br />浠庣涓琛屽紑濮嬭蛋鍒版渶鍚庝竴琛岋紝姣忔鍙互鍚戜笅璧版垨鍙充笅璧般?br />鎵姹傚嵆涓轟粠絎竴琛岃蛋鍒版渶鍚庝竴琛岀粡榪囩殑鏁版誨拰鐨勬渶澶у箋?br />浠[][]瀛樺偍input銆?br />5
7
3 8
8 1 0
2 7 4 4
|聽聽聽聽聽\ |聽 \
4 5 2 6 5

濡備笂鍥撅紝浠涓鴻錛宩涓哄垪,
d[i][j]涓轟粠絎竴琛岃蛋鍒扮i琛岀j鍒楃殑鏈澶у箋?br />瀵逛簬(i,j)榪欎釜鐐癸紝瀹冨彲浠ヤ粠涓嶅悓鏂瑰悜璧版潵錛屽鍥? | '浠h〃浠庝笂鏂硅蛋鏉ワ紝' \ '浠h〃浠庡乏涓婃柟璧版潵銆?br />
鍒欏姩鎬佽鍒欐柟紼嬩負錛?br />聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 聽{聽聽聽聽聽d[i-1][1]+p[i][1]聽聽聽(j=1)
d[i][j]=Max{聽聽聽聽 Max( d[i-1][j-1] , d[i-1][j] ) + p[i][j]聽聽聽(1<j<i)
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 {聽聽聽聽 d[i-1][i-1]+p[i][i]聽聽聽(j=i)

緇撴灉涓篗ax(d[n][j]) , (1<=j<=n)

浠g爜濡備笅錛?pre>

#include<cstdio>
int p[100][100];
int d[100][100];
int Max(int a,int b)
{return a>b?a:b;}
int main()
{
	int i,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		int j;
		for(j=1;j<=i;j++)
			scanf("%d",p[i]+j);
	}
	d[1][1]=p[1][1];
	for(i=2;i<=n;i++)
	{
		int j;
		d[i][1]=d[i-1][1]+p[i][1];
		for(j=2;j<=i;j++)
			d[i][j]=Max(d[i-1][j-1],d[i-1][j])+p[i][j];
		d[i][i]=d[i-1][i-1]+p[i][i];
	}
	int max=0;
	for(i=1;i<=n;i++)
	{
		if(d[n][i]>max)
			max=d[n][i];
	}
	printf("%d\n",max);
	return 0;
}



beyonlin 2006-08-28 10:31 鍙戣〃璇勮
]]>
娣卞害浼樺厛鎼滅儲http://www.shnenglu.com/shyli/archive/2006/08/28/11759.htmlbeyonlinbeyonlinSun, 27 Aug 2006 17:23:00 GMThttp://www.shnenglu.com/shyli/archive/2006/08/28/11759.htmlhttp://www.shnenglu.com/shyli/comments/11759.htmlhttp://www.shnenglu.com/shyli/archive/2006/08/28/11759.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/11759.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/11759.html鑷蟲瀵瑰箍搴﹀拰娣卞害鏈変簡涓涓熀鏈殑浜嗚В銆?br />瀛CM鎬葷畻瀛﹀埌浜嗕竴鐐歸潪鏆村姏瑙e喅闂鐨勬柟娉曘?br />Problem Id:1154聽聽User Id:beyonlin_SCUT
Memory:32K聽聽Time:155MS
Language:C++聽聽Result:Accepted
http://acm.pku.edu.cn/JudgeOnline/problem?id=1154

LETTERS
Time Limit:1000MS聽 Memory Limit:10000K
Total Submit:694 Accepted:334

Description
A single-player game is played on a rectangular board divided in R rows and C columns. There is a single uppercase
letter (A-Z) written in every position in the board.
Before the begging of the game there is a figure in the upper-left corner of the board (first row, first column). In every move, a player can move the figure to the one of the adjacent positions (up, down,left or right). Only constraint is that
a figure cannot visit a position marked with the same letter twice.
The goal of the game is to play as many moves as possible.
Write a program that will calculate the maximal number of positions in the board the figure can visit in a single game.

Input
The first line of the input contains two integers R and C, separated by a single blank character, 1 <= R, S <= 20.
The following R lines contain S characters each. Each line represents one row in the board.

Output
The first and only line of the output should contain the maximal number of position in the board the figure can visit.

Sample Input

3 6
HFDFFB
AJHGDH
DGAGEH

Sample Output

6

鎴戠殑紼嬪簭錛?br />#include<cstdio>
#include<stack>
using namespace std;
struct node
{
	int row;
	int col;
	int dire;
};
char p[30][30];
char flag[30];
int incr[4][2]={{0,1},{1,0},{0,-1},{-1,0}};
int main()
{
	int i,row,col;
	scanf("%d%d",&row,&col);
	getchar();
	char ch[30];
	for(i=1;i<=row;i++)
	{
		gets(ch);
		int j;
		for(j=1;j<=col;j++)
			p[i][j]=ch[j-1];
	}
	//鍒濆鍖栵紝澶栧姞涓灞?
	for(i=0;i<=col+1;i++)
	{
		p[0][i]='0';
		p[row+1][i]='0';
	}
	for(i=0;i<=row+1;i++)
	{
		p[i][0]='0';
		p[i][col+1]='0';
	}
	int Maxmove=0;//鏈澶ф鏁?
	stack<node>path;
聽聽聽聽聽聽聽聽//鏍堝垵濮嬪寲 int r=1,c=1,dire=0,f=0,move=1; node in; in.row=r; in.col=c; in.dire=dire; path.push(in); flag[f++]=p[r][c]; while(!path.empty()) { if(dire<4) { int r2=r+incr[dire][0]; int c2=c+incr[dire][1]; bool b=true; for(int k=0;k<f;k++)//鎼滅儲鏄惁宸茶闂垨璺笉閫? { if(flag[k]==p[r2][c2] || p[r2][c2]=='0') { dire++; b=false; break; } } if(b)//璺? { node in; in.row=r2; in.col=c2; in.dire=dire; path.push(in);//榪涙爤 move++; flag[f++]=p[r2][c2];//鏍囧織宸茶闂? r=r2; c=c2; dire=0; } } else//鎵懼埌涓涓В { if(move>Maxmove) Maxmove=move; move--; dire=path.top().dire+1; //鍥炴函錛屽幓闄よ闂爣蹇? path.pop(); flag[--f]='\0'; if(!path.empty()) { r=path.top().row; c=path.top().col; } } } printf("%d\n",Maxmove); return 0; }



beyonlin 2006-08-28 01:23 鍙戣〃璇勮
]]>
騫垮害浼樺厛鎼滅儲http://www.shnenglu.com/shyli/archive/2006/08/24/11633.htmlbeyonlinbeyonlinThu, 24 Aug 2006 02:25:00 GMThttp://www.shnenglu.com/shyli/archive/2006/08/24/11633.htmlhttp://www.shnenglu.com/shyli/comments/11633.htmlhttp://www.shnenglu.com/shyli/archive/2006/08/24/11633.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/11633.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/11633.html浠婂ぉ鍦≒KU涓婂仛浜嗘垜絎竴棰樺箍搴︿紭鍏堟悳绱㈤錛?br />Problem Id:2627聽聽User Id:beyonlin_SCUT
Memory:64K聽聽Time:575MS
Language:C++聽聽Result:Accepted
涓漢璁や負綆楁硶澶嶆潅搴﹀簲璇ヤ負O(n^2)鎴栨洿灝忋備笉鐭ユ槸涓嶆槸榪欐牱銆?br />http://acm.pku.edu.cn/JudgeOnline/problem?id=2627

Gopher and hawks
Time Limit:1000MS聽 Memory Limit:65536K
Total Submit:900 Accepted:328

Description
A gopher sits in a hole located at (xs, ys) and wants to get to a hole located at (xt, yt). The gopher can run at a constant speed of v m/sec. However, if the gopher is outside of a hole for more than a m minutes he will become a supper to hawks flying over the holes. Can the gopher make it?

Input
The first line of input contains two positive integer numbers: v -- gopher's speed in meters per second and m -- the time after which the gopher becomes prey to hawks if he stays outside a hole. The second line of input contains two floating point numbers: the (xs,ys) coordinates of the gopher starting hole. The third line contains the (xt, yt) coordinates of the target hole. Each Subsequent line of input contains two floating point numbers: the (x,y) coordinates of a gopher hole. All distances are in metres, to the nearest mm.

Output
If the gopher can make it to the target hole, the output line should read "Yes, visiting n other holes.", where n is the minimal number of intermediate holes the gopher has to visit. If the gopher cannot make it the output line should read "No." There are not more than 1000 gopher holes and all coordinates are between -10000 and +10000.

Sample Input

3 1
0.000 0.000
500.000 0.000
179.000 0.000
358.000 0.000

Sample Output

Yes, visiting 2 other holes.

Hint
Sample input 2
5 1
0.000 0.000
0.000 550.000
179.000 0.000
0.000 301.000

Output for sample input 2
No.


鎴戠殑紼嬪簭錛?br />

#include<cstdio> #include<cmath> #include<queue> using namespace std; struct node { int point; int step; }; double x[1100],y[1100]; bool flag[1100]={false}; int main() { int i,v,t; scanf("%d%d",&v,&t); t*=60; double beginX,beginY,endX,endY; scanf("%lf%lf%lf%lf",&beginX,&beginY,&endX,&endY); int n=1; while(scanf("%lf%lf",x+n,y+n)!=EOF) n++; x[0]=beginX; y[0]=beginY; x[n]=endX; y[n]=endY; node n1;//闃熷垪鍒濆鍖? n1.point=0; n1.step=0; queue<node> que; que.push(n1); int steps=0; while(true) { if(que.empty()) break; node tmp=que.front(); que.pop();//鍑洪槦鍒? for(i=1;i<=n;i++) { if(!flag[i])//鏍囧織鏄惁榪涜繃闃熷垪 { double time=sqrt(pow(x[i]-x[tmp.point],2.0)+pow(y[i]-y[tmp.point],2.0))/v; if(time<t) { if(i==n) { steps=tmp.step; goto next; } else { node in; in.point=i; in.step=tmp.step+1; que.push(in);//榪涢槦鍒? flag[i]=true; } } } } } next: if(steps!=0) printf("Yes, visiting %d other holes.\n",steps); else printf("No.\n"); return 0; }



beyonlin 2006-08-24 10:25 鍙戣〃璇勮
]]>
鑰冭瘯浜嗭紝ACM鏆傚憡涓孌佃惤http://www.shnenglu.com/shyli/archive/2006/05/25/7657.htmlbeyonlinbeyonlinThu, 25 May 2006 12:35:00 GMThttp://www.shnenglu.com/shyli/archive/2006/05/25/7657.htmlhttp://www.shnenglu.com/shyli/comments/7657.htmlhttp://www.shnenglu.com/shyli/archive/2006/05/25/7657.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/7657.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/7657.html椹笂灝辮鏈熸湯鑰冧簡錛?br />
ACM鏆傚憡涓孌佃惤錛?br />
鑰冨畬璇曞悗鍐嶆葷粨涓涓嬭繖涓鏈熺殑ACM銆?/font>

beyonlin 2006-05-25 20:35 鍙戣〃璇勮
]]>
My Statushttp://www.shnenglu.com/shyli/archive/2006/04/17/5745.htmlbeyonlinbeyonlinMon, 17 Apr 2006 04:59:00 GMThttp://www.shnenglu.com/shyli/archive/2006/04/17/5745.htmlhttp://www.shnenglu.com/shyli/comments/5745.htmlhttp://www.shnenglu.com/shyli/archive/2006/04/17/5745.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/5745.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/5745.html

My Status

Problem
status
time
A
Yes
39
B
Yes
77
G
No-Time-limit Exceeded
96
G
Yes
113
C
Yes
211
E
No-Time-limit Exceeded
265

Solved 4聽聽聽聽Time 460



beyonlin 2006-04-17 12:59 鍙戣〃璇勮
]]>
Rank Name Solved Timehttp://www.shnenglu.com/shyli/archive/2006/04/17/5676.htmlbeyonlinbeyonlinSun, 16 Apr 2006 17:25:00 GMThttp://www.shnenglu.com/shyli/archive/2006/04/17/5676.htmlhttp://www.shnenglu.com/shyli/comments/5676.htmlhttp://www.shnenglu.com/shyli/archive/2006/04/17/5676.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/5676.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/5676.htmlRank Name Solved Time

1 16 - team16 8 984
2 13 - team13 8 1141
3 44 - team44 7 718
4 64 - team64 7 1247
5 65 - team65 6 564
6 10 - team10 6 642
7 21 - team21 6 684
8 7 - team7 6 830
9 89 - team89 5 414
10 73 - team73 5 448
11 83 - team83 5 559
12 18 - team18 5 561
13 24 - team24 5 716
14 51 - team51 5 753
15 81 - team81 5 846
16 56 - team56 5 898
17 15 - team15 4 238
18 72 - team72 4 284
19 57 - team57 4 295
20 49 - team49 4 306
21 43 - team43 4 311
22 62 - team62 4 315
23 4 - team4 4 318
24 8 - team8 4 321
25 26 - team26 4 375
26 3 - team3 4 412
27 45 - team45 4 432
28 69 - team69 4 448
29 27 - team27 4 460
30 88 - team88 4 478
31 50 - team50 4 482
32 66 - team66 4 490
33 48 - team48 4 496
34 11 - team11 4 498
35 79 - team79 4 511
36 71 - team71 4 518
37 47 - team47 4 575
38 77 - team77 4 580
39 19 - team19 4 597
40 9 - team9 4 600
41 68 - team68 4 630
42 90 - team90 4 642
43 20 - team20 4 721
44 37 - team37 4 727
45 29 - team29 4 770
46 12 - team12 4 772
47 61 - team61 4 783
48 22 - team22 4 792
49 41 - team41 4 858
50 63 - team63 4 893
51 34 - team34 4 943
52 76 - team76 3 257
53 54 - team54 3 262
54 39 - team39 3 277
55 60 - team60 3 316
56 82 - team82 3 325
57 1 - team1 3 331
58 25 - team25 3 333
59 36 - team36 3 341
60 86 - team86 3 342
61 70 - team70 3 360
62 52 - team52 3 369
63 78 - team78 3 402
64 14 - team14 3 490
65 6 - team6 3 547
66 80 - team80 3 618
67 5 - team5 2 133
68 38 - team38 2 243
69 2 - team2 2 250
70 74 - team74 2 253
71 55 - team55 2 258
72 58 - team58 2 262
73 84 - team84 2 296
74 23 - team23 2 319
75 40 - team40 2 328
76 91 - team91 2 343
77 42 - team42 2 356
78 100 - other 2 437
79 87 - team87 2 459
80 67 - team67 1 88
81 33 - team33 1 118
82 28 - team28 1 193
83 99 - team99 1 313
84 17 - team17 0 0
84 30 - team30 0 0
84 31 - team31 0 0
84 32 - team32 0 0
84 35 - team35 0 0
84 46 - team46 0 0
84 53 - team53 0 0
84 59 - team59 0 0
84 75 - team75 0 0
84 85 - team85 0 0聽

鎴戠殑闃熷彿錛?7-team27

beyonlin 2006-04-17 01:25 鍙戣〃璇勮
]]>
ACM绔炶禌钀戒笅甯峰箷http://www.shnenglu.com/shyli/archive/2006/04/17/5675.htmlbeyonlinbeyonlinSun, 16 Apr 2006 17:24:00 GMThttp://www.shnenglu.com/shyli/archive/2006/04/17/5675.htmlhttp://www.shnenglu.com/shyli/comments/5675.htmlhttp://www.shnenglu.com/shyli/archive/2006/04/17/5675.html#Feedback0http://www.shnenglu.com/shyli/comments/commentRss/5675.htmlhttp://www.shnenglu.com/shyli/services/trackbacks/5675.html鎴戞牎絎簩灞夾CM/ICPC绔炶禌緇忓巻5涓皬鏃跺悗緇堜簬钀戒笅甯峰箷銆?br />
浠庢棭涓?0鐐瑰埌涓嬪崍3鐐癸紝鎴戦槦緇忚繃鍏卞悓鍔姏緇堜簬瑙e喅浜?棰樹腑鐨?棰樸?br />
鍦?0澶氶槦涓帓鍚?9銆?br />
鍥犱負鏄ぇ涓錛屼篃娌℃湁緇忛獙錛屽張娌℃湁鐪嬬畻娉曚功錛屾墍浠ュ彧鍋氬嚭浜嗗嚑棰樼畝鍗曠殑銆?br />
涔熸湁浜涘ぇ涓鐨勭墰浜烘悶瀹?棰?棰樼殑錛岀湡鏄儹鎰?

浠ュ悗緇х畫鍔姏銆?br />
鍏堝啓涓嬫垜鐨勯槦鍚嶅惂錛歋CTCS

闃熷彿錛?7-team27

鏈夊縐版劅鍚с?br />
鍏堟妸鍚勯槦鐨勬垚緇╄涓嬫潵鍚с?br />
鍥犻槦杈冨錛岃鐐瑰嚮榪欓噷鏌ョ湅銆?/font>

鎴戠殑姣旇禌鐘舵?/a>銆?/font>

beyonlin 2006-04-17 01:24 鍙戣〃璇勮
]]>
璋ㄦ厧瀛楃鏁扮粍涓嬫爣瓚婄晫錛?/title><link>http://www.shnenglu.com/shyli/archive/2006/03/28/4669.html</link><dc:creator>beyonlin</dc:creator><author>beyonlin</author><pubDate>Mon, 27 Mar 2006 17:11:00 GMT</pubDate><guid>http://www.shnenglu.com/shyli/archive/2006/03/28/4669.html</guid><wfw:comment>http://www.shnenglu.com/shyli/comments/4669.html</wfw:comment><comments>http://www.shnenglu.com/shyli/archive/2006/03/28/4669.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.shnenglu.com/shyli/comments/commentRss/4669.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/shyli/services/trackbacks/4669.html</trackback:ping><description><![CDATA[ <p> <font color="#808080" size="2">浠婂ぉ鍋欰CM灝辨槸鐢變簬娌℃湁娉ㄦ剰榪欎釜闂鑰學rong Aswer浜嗗嚑嬈°?/font> </p> <p> <font color="#808080" size="2">棰樼洰璇存槑瑕佽緭鍏ョ殑瀛楃涓查暱搴︽渶澶氫負8銆?/font> </p> <p> <font color="#808080" size="2">鍥犳鎴戝氨鍙敵璇蜂簡8涓瓧絎︺?/font> </p> <p> <font color="#808080" size="2">緇撴灉褰撶劧灝辨槸閿欎簡銆?/font> </p> <p> <font color="#808080" size="2">鍏跺疄瀛楃鏁扮粍闇瑕佷竴涓瓨鍌ㄥ崟鍏冩潵淇濆瓨緇撴潫絎︹淺0鈥濓紝</font> </p> <p> <font color="#808080" size="2">鐢ㄦ潵璇存槑涓涓瓧絎︿覆緇撴潫浜嗐?/font> </p> <p> <font color="#808080" size="2">鍥犳瑕佺敵璇鋒瘮瀛楃涓插涓涓瓨鍌ㄥ崟鍏冪殑闀垮害銆?/font> </p> <p> <font color="#808080" size="2">璁頒綇浜嗭紒錛?/font> </p> <p> <font color="#808080" size="2">浠庢涓嶈兘鐘悓鏍烽敊璇紒<br /></font> </p> <img src ="http://www.shnenglu.com/shyli/aggbug/4669.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/shyli/" target="_blank">beyonlin</a> 2006-03-28 01:11 <a href="http://www.shnenglu.com/shyli/archive/2006/03/28/4669.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浠婂ぉ鐪熸槸涓嶇埥錛?/title><link>http://www.shnenglu.com/shyli/archive/2006/03/26/4624.html</link><dc:creator>beyonlin</dc:creator><author>beyonlin</author><pubDate>Sun, 26 Mar 2006 08:26:00 GMT</pubDate><guid>http://www.shnenglu.com/shyli/archive/2006/03/26/4624.html</guid><wfw:comment>http://www.shnenglu.com/shyli/comments/4624.html</wfw:comment><comments>http://www.shnenglu.com/shyli/archive/2006/03/26/4624.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/shyli/comments/commentRss/4624.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/shyli/services/trackbacks/4624.html</trackback:ping><description><![CDATA[ <font color="#808080" size="2">鍋欰CM棰樼洰宸茬粡鏈変袱涓湀浜嗐?br /><br />鍦ㄥ寳澶х殑緗戠珯涓婁篃鍋氫簡鍑犲崄閬撻浜嗐?br /><br />浠婂ぉ鍦ㄥ寳澶х綉绔欎笂鍙堣繋鏉CM鏈堣禌銆?br /><br />鏃墮棿鏄粖澶╀腑鍗?2錛?0鑷?7:00銆?br /><br />鍙槸鍋氫簡鎴戜笁涓崐灝忔椂涔熸病鍋氬嚭鏉ヤ竴棰樻潵銆?br /><br />涓嶇埥錛侊紒</font> <img src ="http://www.shnenglu.com/shyli/aggbug/4624.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/shyli/" target="_blank">beyonlin</a> 2006-03-26 16:26 <a href="http://www.shnenglu.com/shyli/archive/2006/03/26/4624.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.reababy.cn" target="_blank">99久久超碰中文字幕伊人</a>| <a href="http://www.dush.net.cn" target="_blank">无码精品久久一区二区三区</a>| <a href="http://www.jumingyang.cn" target="_blank">三上悠亚久久精品</a>| <a href="http://www.a13859701381.cn" target="_blank">色欲久久久天天天综合网精品</a>| <a href="http://www.jn879.cn" target="_blank">亚洲国产精品成人久久</a>| <a href="http://www.126yi.cn" target="_blank">久久久精品人妻一区二区三区蜜桃 </a>| <a href="http://www.111party.cn" target="_blank">久久久久久伊人高潮影院</a>| <a href="http://www.xnhtml.com.cn" target="_blank">久久影院综合精品</a>| <a href="http://www.cnhuirui.cn" target="_blank">亚洲乱亚洲乱淫久久</a>| <a href="http://www.248hh.cn" target="_blank">伊人久久综合精品无码AV专区</a>| <a href="http://www.esld.cn" target="_blank">好属妞这里只有精品久久</a>| <a href="http://www.modellesson.cn" target="_blank">久久人人爽人人精品视频</a>| <a href="http://www.jaqw.cn" target="_blank">www.久久热</a>| <a href="http://www.t2tt.cn" target="_blank">亚洲精品无码久久久久去q </a>| <a href="http://www.ikde.cn" target="_blank">91精品国产高清久久久久久91</a>| <a href="http://www.jxfic.org.cn" target="_blank">久久五月精品中文字幕</a>| <a href="http://www.xsoczv19.cn" target="_blank">久久99精品久久久久久</a>| <a href="http://www.t55n3z.cn" target="_blank">亚洲国产欧美国产综合久久</a>| <a href="http://www.huodiba.cn" target="_blank">久久人人爽人人爽AV片</a>| <a href="http://www.scqpw.cn" target="_blank">久久亚洲国产中v天仙www</a>| <a href="http://www.nicemom.cn" target="_blank">亚洲狠狠婷婷综合久久蜜芽</a>| <a href="http://www.z8990.cn" target="_blank">麻豆久久</a>| <a href="http://www.pianjuan.cn" target="_blank">欧美成a人片免费看久久</a>| <a href="http://www.job126.cn" target="_blank">精品久久久久久中文字幕</a>| <a href="http://www.gmmk.net.cn" target="_blank">日韩人妻无码精品久久免费一 </a>| <a href="http://www.sevengreen.cn" target="_blank">久久人与动人物a级毛片</a>| <a href="http://www.bolidianqi.cn" target="_blank">国产精品一区二区久久精品无码 </a>| <a href="http://www.sdlove.cn" target="_blank">精品一区二区久久</a>| <a href="http://www.vetg.cn" target="_blank">久久久久久午夜成人影院</a>| <a href="http://www.take-art.cn" target="_blank">久久精品人人做人人爽电影</a>| <a href="http://www.jpcn2.cn" target="_blank">亚洲色欲久久久久综合网</a>| <a href="http://www.dachanzui.cn" target="_blank">久久婷婷五月综合97色直播</a>| <a href="http://www.qqschool.cn" target="_blank">国产精品九九久久精品女同亚洲欧美日韩综合区 </a>| <a href="http://www.78cbg.cn" target="_blank">99久久精品国产一区二区</a>| <a href="http://www.shy114.cn" target="_blank">久久国产免费</a>| <a href="http://www.panroad.cn" target="_blank">久久久久久一区国产精品</a>| <a href="http://www.tyo8.cn" target="_blank">国产精品热久久毛片</a>| <a href="http://www.rahd.cn" target="_blank">久久精品无码一区二区日韩AV</a>| <a href="http://www.epcinet.cn" target="_blank">国产免费久久久久久无码</a>| <a href="http://www.daodaoo.cn" target="_blank">精品久久久久久国产牛牛app</a>| <a href="http://www.a79wvh.cn" 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>