锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久永久免费人妻精品下载,久久精品视频网,国产精品99久久久久久人http://www.shnenglu.com/yzhw/category/15527.htmlzh-cnThu, 09 Jun 2011 18:43:18 GMTThu, 09 Jun 2011 18:43:18 GMT60pku3167 Cow Patterns KMP濂介http://www.shnenglu.com/yzhw/archive/2011/06/05/148094.htmlyzhwyzhwSun, 05 Jun 2011 01:35:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/06/05/148094.htmlhttp://www.shnenglu.com/yzhw/comments/148094.htmlhttp://www.shnenglu.com/yzhw/archive/2011/06/05/148094.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/148094.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/148094.htmlK闀垮害鐨勬ā寮忎覆錛孨闀垮害鐨勪富涓詫紝姹傚灝戜釜浣嶇疆鑳藉鍖歸厤銆?br />榪欓噷妯″紡涓蹭互鍙婁富涓查噷鐨勫煎潎涓簉ank錛屽嵆15567鍜?6678璁や負鏄尮閰嶇殑銆?br />
瑙f硶錛?br />瀵逛簬榪欑rank綾伙紝鍒ゆ柇鏄惁鐩哥瓑灝辨槸鍒ゆ柇鍦ㄦ鏁頒箣鍓嶅ぇ浜庤繖涓暟瀛楃殑鏁板瓧涓暟銆佺瓑浜庤繖涓暟瀛楃殑鏁板瓧涓暟浠ュ強灝忎簬榪欎釜鏁板瓧鐨勬暟瀛椾釜鏁版槸鍚﹀潎鐩哥瓑銆傛帴涓嬫潵鐨勮繃紼嬪氨綾諱技KMP鐨勫尮閰嶄簡銆?br />鍙﹀錛孠MP nxt鏁扮粍鏈川鏄渶闀垮悗緙=鏈闀垮墠緙錛?span style="color: red;">鍚屾椂瑕佹眰鍚庣紑涓嶈兘涓烘暣涓瓧絎︿覆銆傚ソ涔呬笉鍐橩MP錛岀珶鐒剁姱浜嗕釜緋婃秱鐨勪簨鎯咃紝nxt鏁扮粍閲岀畻鍑烘潵绔熺劧鏄?,2,3,4.銆傘傛棤璇?br />
浠g爜錛?br />
 1 Source Code
 2 Problem: 3167        User: yzhw
 3 Memory: 24496K        Time: 813MS
 4 Language: GCC        Result: Accepted
 5 
 6     Source Code
 7 
 8     # include <stdio.h>
 9     # include <string.h>
10     # define N 100005
11     # define M 30
12     int n,k,s;
13     int cal1[N][M],cal2[N][M],nxt[N],d1[N],d2[N];
14     int equal(int *e1,int *s1,int *e2,int *s2,int val1,int val2)
15     {
16         if(e1[val1-1]-s1[val1-1]==e2[val2-1]-s2[val2-1]&&
17            (e1[val1]-e1[val1-1])-(s1[val1]-s1[val1-1])==(e2[val2]-e2[val2-1])-(s2[val2]-s2[val2-1])&&
18            (e1[s]-e1[val1])-(s1[s]-s1[val1])==(e2[s]-e2[val2])-(s2[s]-s2[val2]))
19         return 1;
20         else return 0;
21     }
22     int main()
23     {
24         int i,t,j,p,total=0;
25         //freopen("cpattern.9.in","r",stdin);
26         //freopen("ans.txt","w",stdout);
27 
28         scanf("%d%d%d",&n,&k,&s);
29         memset(cal1,0,sizeof(cal1));
30         memset(cal2,0,sizeof(cal2));
31         for(i=1;i<=n;i++)
32         {
33             scanf("%d",&t);
34             d2[i]=t;
35             //cal2[i][t]++;
36             for(j=1;j<=s;j++)
37                 cal2[i][j]+=cal2[i-1][j];
38             for(j=t;j<=s;j++)
39                 cal2[i][j]++;
40 
41         }
42         for(i=1;i<=k;i++)
43         {
44             scanf("%d",&t);
45             d1[i]=t;
46             //cal1[i][t]++;
47             for(j=1;j<=s;j++)
48                 cal1[i][j]+=cal1[i-1][j];
49             for(j=t;j<=s;j++)
50                 cal1[i][j]++;
51         }
52         nxt[1]=0;
53         for(i=2;i<=k;i++)
54         {
55             p=nxt[i-1];
56             while(p&&!equal(cal1[p+1],cal1[0],cal1[i],cal1[i-p-1],d1[p+1],d1[i]))
57                 p=nxt[p];
58             if(equal(cal1[p+1],cal1[0],cal1[i],cal1[i-p-1],d1[p+1],d1[i])) nxt[i]=p+1;
59             else nxt[i]=0;
60         }
61         p=0;
62         for(i=1;i<=n;i++)
63         {
64             while(p&&!equal(cal1[p+1],cal1[0],cal2[i],cal2[i-p-1],d1[p+1],d2[i])) p=nxt[p];
65             if(equal(cal1[p+1],cal1[0],cal2[i],cal2[i-p-1],d1[p+1],d2[i])) p++;
66             if(p==k)
67             {
68                 total++;
69                 p=nxt[p];
70             }
71         }
72         printf("%d\n",total);
73         p=0;
74         for(i=1;i<=n;i++)
75         {
76             while(p&&!equal(cal1[p+1],cal1[0],cal2[i],cal2[i-p-1],d1[p+1],d2[i])) p=nxt[p];
77             if(equal(cal1[p+1],cal1[0],cal2[i],cal2[i-p-1],d1[p+1],d2[i])) p++;
78             if(p==k)
79             {
80                 printf("%d\n",i-k+1);
81                 p=nxt[p];
82             }
83         }
84         return 0;
85     }
86 
87 


yzhw 2011-06-05 09:35 鍙戣〃璇勮
]]>
pku1245-1251 Mid-Central USA 2002 姣旇禌鎬葷粨http://www.shnenglu.com/yzhw/archive/2011/01/21/138992.htmlyzhwyzhwThu, 20 Jan 2011 18:21:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/21/138992.htmlhttp://www.shnenglu.com/yzhw/comments/138992.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/21/138992.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/138992.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/138992.html闃呰鍏ㄦ枃

yzhw 2011-01-21 02:21 鍙戣〃璇勮
]]>
pku 1816 wild words trie鏍戠殑媧葷敤http://www.shnenglu.com/yzhw/archive/2011/01/13/138475.htmlyzhwyzhwThu, 13 Jan 2011 10:05:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/13/138475.htmlhttp://www.shnenglu.com/yzhw/comments/138475.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/13/138475.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/138475.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/138475.html妯℃澘鍖呮嫭3縐嶅瓧絎︼細
a-z錛氭爣鍑嗗瓧絎?br>閫氶厤絎?錛屼唬琛ㄤ換鎰忎竴涓瓧絎?br>*錛氫唬琛?涓垨澶氫釜瀛楃

鍏堢粰鍑簄涓ā鏉夸覆錛宮涓瓧絎︿覆錛岄棶姣忎釜瀛楃涓插垎鍒尮閰嶉偅鍑犱釜妯℃澘涓?br>n<=1e6,m<=1e2錛宻trlen<20

瑙f硶錛?br>鐢╰rie鏍戞瀯寤烘ā鏉夸覆錛岀劧鍚庡啀dfs鏉ュ尮閰?br>搴斾負妯℃澘涓蹭腑鏈夐噸澶嶄覆錛屼竴涓畝鍗曠殑鏂規硶鏄紝寮杈熶竴涓摼琛ㄧ┖闂達紝閾炬帴姣忎釜妯℃澘涓茬殑鏈妭鐐?br>鐒跺悗鍒ゆ柇姣忎釜瀛楃涓叉椂DFS涓嬈★紝灝嗚兘鍒拌揪鐨勫熬閮ㄨ妭鐐瑰仛涓爣璁幫紝鐒跺悗鏍規嵁涔嬪墠璁板綍鐨勯摼琛ㄦ壂涓閬嶅氨鐭ラ亾鍒拌揪榪囧摢浜涙ā鏉夸覆鐨勬牴鑺傜偣錛堝尮閰嶄簡鍝簺妯℃澘涓詫級
DFS鐨勬椂鍊欒娉ㄦ剰涓嬪嚑鐐癸細
1銆佺姸鎬佽瀹氾細(鑺傜偣緙栧彿銆佸綋鍓嶅瓧絎︿覆浣嶇疆)
2銆佸鏋滃綋鍓嶈妭鐐逛腑瀛樺湪'?"鐨勮漿縐昏礬寰勶紝鍒欒漿縐昏繃鍘?br>3銆佸鏋滃綋鍓嶈妭鐐瑰瓨鍦?*'鐨勮漿縐昏礬寰勶紝鏋氫婦*鍖歸厤鐨勯暱搴︼紝鐒跺悗杞Щ
鎬誨鏉傚害1e7宸﹀彸銆傘傘備笉鐭ラ亾鏈変粈涔堝ソ鐨勬柟娉曪紝鎴戠殑紼嬪簭C++璺戜簡400MS銆傘傘備笉綆楀揩鐨勩傘?br>
鍙﹀錛岃繖棰樺緩璁敤鍔ㄦ佸唴瀛樺垎閰嶏紝鎴戝紑濮嬪紑浜?00W鐨刡uffer錛岀珶鐒禡LE銆傘傘傘?br>浠g爜錛?br>
 1# include <cstdio>
 2# include <cstring>
 3# include <cstdlib>
 4
 5using namespace std;
 6struct node
 7{
 8    node *nxt[28];
 9    bool in;
10    node()
11    {
12          memset(nxt,NULL,sizeof(nxt));
13          in=false;
14    }

15}
*ans[100005],head;
16char map[255];
17int c=1;
18node* insert(char *str)
19{
20   node *p=&head;
21   for(int i=0;str[i]!='\0';i++)
22   {
23      if(p->nxt[map[str[i]]]==NULL)
24         p->nxt[map[str[i]]]=new node();
25      p=p->nxt[map[str[i]]];
26   }

27   return p;
28}

29void match(node *p,char *str)
30{
31     if(!p) return;
32     if(*str=='\0')
33     {
34        p->in=true;
35        match(p->nxt[27],str);
36     }

37     else
38     {
39         match(p->nxt[map[*str]],str+1);
40         match(p->nxt[26],str+1);
41         for(int i=0;i<=strlen(str);i++)
42           match(p->nxt[27],str+i);
43     }

44}

45int main()
46{
47    int n,m;
48    for(int i='a';i<='z';i++)
49       map[i]=i-'a';
50    map['?']=26;
51    map['*']=27;
52    scanf("%d%d",&n,&m);
53    for(int i=0;i<n;i++)
54    {
55       char str[10];
56       scanf("%s",str);
57       ans[i]=insert(str);
58    }

59    for(int i=0;i<m;i++)
60    {
61        for(int j=0;j<n;j++) ans[j]->in=false;
62        char str[128];
63        scanf("%s",str);
64        match(&head,str);
65        bool flag=false;
66        for(int j=0;j<n;j++)
67          if(ans[j]->in)
68           {
69              flag=true;
70              printf("%d ",j);
71           }

72        if(flag) printf("\n");
73        else printf("Not match\n");
74    }

75  // system("pause");
76    return 0;
77}

78



yzhw 2011-01-13 18:05 鍙戣〃璇勮
]]>
pku 1625 Censored! 鑷姩鏈虹粡鍏擱錛屾墜鍐欓珮綺懼害WA浜?嬈°傘傘傘傘?/title><link>http://www.shnenglu.com/yzhw/archive/2011/01/13/138432.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Thu, 13 Jan 2011 01:57:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2011/01/13/138432.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/138432.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2011/01/13/138432.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/138432.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/138432.html</trackback:ping><description><![CDATA[棰樻剰錛?br>闂笉鍖呭惈n涓瓙涓茬殑闀垮害涓簃鐨勫瓧絎︿覆鐨勬瀯閫犱釜鏁般?br><br>瑙f硶錛?br>鏋勯爐rie鍥撅紝鐒跺悗DP姹傞暱搴︿負m鐨勫悎娉曚覆涓暟<br>浠ュ墠楂樼簿搴﹂兘闈爅ava錛岃繖嬈℃墜鍐欙紝鍚勭閿欒銆傘傘傚攭銆傘?br><br>浠g爜錛?br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<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;">iostream</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;">cstring</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #008080;">  3</span> <span style="color: #000000;"></span><span style="color: #0000ff;">using</span><span style="color: #000000;"> </span><span style="color: #0000ff;">namespace</span><span style="color: #000000;"> std;<br></span><span style="color: #008080;">  4</span> <span style="color: #000000;"></span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> BigInteger<br></span><span style="color: #008080;">  5</span> <span style="color: #000000;">{<br></span><span style="color: #008080;">  6</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> bit[</span><span style="color: #000000;">100</span><span style="color: #000000;">];<br></span><span style="color: #008080;">  7</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">bool</span><span style="color: #000000;"> init;<br></span><span style="color: #008080;">  8</span> <span style="color: #000000;">    BigInteger()<br></span><span style="color: #008080;">  9</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;"> 10</span> <span style="color: #000000;">        memset(bit,</span><span style="color: #000000;">0</span><span style="color: #000000;">,</span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(bit));<br></span><span style="color: #008080;"> 11</span> <span style="color: #000000;">        init</span><span style="color: #000000;">=</span><span style="color: #0000ff;">true</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;">    BigInteger </span><span style="color: #0000ff;">operator</span><span style="color: #000000;">+</span><span style="color: #000000;">(</span><span style="color: #0000ff;">const</span><span style="color: #000000;"> BigInteger </span><span style="color: #000000;">&</span><span style="color: #000000;">pos)<br></span><span style="color: #008080;"> 14</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;"> 15</span> <span style="color: #000000;">        BigInteger res;<br></span><span style="color: #008080;"> 16</span> <span style="color: #000000;">        res.init</span><span style="color: #000000;">=</span><span style="color: #000000;">init;<br></span><span style="color: #008080;"> 17</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i</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;">99</span><span style="color: #000000;">;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;"> 18</span> <span style="color: #000000;">        {<br></span><span style="color: #008080;"> 19</span> <span style="color: #000000;">            res.bit[i]</span><span style="color: #000000;">+=</span><span style="color: #000000;">bit[i]</span><span style="color: #000000;">+</span><span style="color: #000000;">pos.bit[i];<br></span><span style="color: #008080;"> 20</span> <span style="color: #000000;">            res.bit[i</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;">res.bit[i]</span><span style="color: #000000;">/</span><span style="color: #000000;">10</span><span style="color: #000000;">;<br></span><span style="color: #008080;"> 21</span> <span style="color: #000000;">            res.bit[i]</span><span style="color: #000000;">%=</span><span style="color: #000000;">10</span><span style="color: #000000;">;<br></span><span style="color: #008080;"> 22</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;"> 23</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> res;<br></span><span style="color: #008080;"> 24</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;"> 25</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> print()<br></span><span style="color: #008080;"> 26</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;"> 27</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i;<br></span><span style="color: #008080;"> 28</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(i</span><span style="color: #000000;">=</span><span style="color: #000000;">99</span><span style="color: #000000;">;i</span><span style="color: #000000;">></span><span style="color: #000000;">0</span><span style="color: #000000;">&&!</span><span style="color: #000000;">bit[i];i</span><span style="color: #000000;">--</span><span style="color: #000000;">);<br></span><span style="color: #008080;"> 29</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> j</span><span style="color: #000000;">=</span><span style="color: #000000;">i;j</span><span style="color: #000000;">>=</span><span style="color: #000000;">0</span><span style="color: #000000;">;j</span><span style="color: #000000;">--</span><span style="color: #000000;">)<br></span><span style="color: #008080;"> 30</span> <span style="color: #000000;">            cout</span><span style="color: #000000;"><<</span><span style="color: #000000;">bit[j];<br></span><span style="color: #008080;"> 31</span> <span style="color: #000000;">        cout</span><span style="color: #000000;"><<</span><span style="color: #000000;">endl;<br></span><span style="color: #008080;"> 32</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;"> 33</span> <span style="color: #000000;">};<br></span><span style="color: #008080;"> 34</span> <span style="color: #000000;"></span><span style="color: #0000ff;">struct</span><span style="color: #000000;"> node<br></span><span style="color: #008080;"> 35</span> <span style="color: #000000;">{<br></span><span style="color: #008080;"> 36</span> <span style="color: #000000;">    node </span><span style="color: #000000;">*</span><span style="color: #000000;">nxt[</span><span style="color: #000000;">51</span><span style="color: #000000;">],</span><span style="color: #000000;">*</span><span style="color: #000000;">pre;<br></span><span style="color: #008080;"> 37</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">bool</span><span style="color: #000000;"> end;<br></span><span style="color: #008080;"> 38</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">void</span><span style="color: #000000;"> clear()<br></span><span style="color: #008080;"> 39</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;"> 40</span> <span style="color: #000000;">        memset(nxt,NULL,</span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(nxt));<br></span><span style="color: #008080;"> 41</span> <span style="color: #000000;">        end</span><span style="color: #000000;">=</span><span style="color: #0000ff;">false</span><span style="color: #000000;">;<br></span><span style="color: #008080;"> 42</span> <span style="color: #000000;">        pre</span><span style="color: #000000;">=</span><span style="color: #000000;">NULL;<br></span><span style="color: #008080;"> 43</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;"> 44</span> <span style="color: #000000;">    node()<br></span><span style="color: #008080;"> 45</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;"> 46</span> <span style="color: #000000;">        clear();<br></span><span style="color: #008080;"> 47</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;"> 48</span> <span style="color: #000000;">}buffer[</span><span style="color: #000000;">200</span><span style="color: #000000;">];<br></span><span style="color: #008080;"> 49</span> <span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> map[</span><span style="color: #000000;">255</span><span style="color: #000000;">];<br></span><span style="color: #008080;"> 50</span> <span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> c</span><span style="color: #000000;">=</span><span style="color: #000000;">1</span><span style="color: #000000;">,n,m,num;<br></span><span style="color: #008080;"> 51</span> <span style="color: #000000;"></span><span style="color: #0000ff;">void</span><span style="color: #000000;"> insert(</span><span style="color: #0000ff;">char</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">str)<br></span><span style="color: #008080;"> 52</span> <span style="color: #000000;">{<br></span><span style="color: #008080;"> 53</span> <span style="color: #000000;">    node </span><span style="color: #000000;">*</span><span style="color: #000000;">p</span><span style="color: #000000;">=</span><span style="color: #000000;">buffer;<br></span><span style="color: #008080;"> 54</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;str[i]</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;">;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;"> 55</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;"> 56</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">(p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[map[str[i]]]))<br></span><span style="color: #008080;"> 57</span> <span style="color: #000000;">                p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[map[str[i]]]</span><span style="color: #000000;">=&</span><span style="color: #000000;">buffer[c</span><span style="color: #000000;">++</span><span style="color: #000000;">];<br></span><span style="color: #008080;"> 58</span> <span style="color: #000000;">        p</span><span style="color: #000000;">=</span><span style="color: #000000;">p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[map[str[i]]];<br></span><span style="color: #008080;"> 59</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;"> 60</span> <span style="color: #000000;">    p</span><span style="color: #000000;">-></span><span style="color: #000000;">end</span><span style="color: #000000;">=</span><span style="color: #0000ff;">true</span><span style="color: #000000;">;<br></span><span style="color: #008080;"> 61</span> <span style="color: #000000;">}<br></span><span style="color: #008080;"> 62</span> <span style="color: #000000;"></span><span style="color: #0000ff;">void</span><span style="color: #000000;"> make_per()<br></span><span style="color: #008080;"> 63</span> <span style="color: #000000;">{<br></span><span style="color: #008080;"> 64</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> s</span><span style="color: #000000;">=-</span><span style="color: #000000;">1</span><span style="color: #000000;">,e</span><span style="color: #000000;">=-</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;"> 65</span> <span style="color: #000000;">    node </span><span style="color: #000000;">*</span><span style="color: #000000;">q[</span><span style="color: #000000;">200</span><span style="color: #000000;">];<br></span><span style="color: #008080;"> 66</span> <span style="color: #000000;">    node </span><span style="color: #000000;">*</span><span style="color: #000000;">p</span><span style="color: #000000;">=</span><span style="color: #000000;">buffer;<br></span><span style="color: #008080;"> 67</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i</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;">n;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;"> 68</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i])<br></span><span style="color: #008080;"> 69</span> <span style="color: #000000;">        {<br></span><span style="color: #008080;"> 70</span> <span style="color: #000000;">            p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">-></span><span style="color: #000000;">pre</span><span style="color: #000000;">=</span><span style="color: #000000;">p;<br></span><span style="color: #008080;"> 71</span> <span style="color: #000000;">            q[</span><span style="color: #000000;">++</span><span style="color: #000000;">e]</span><span style="color: #000000;">=</span><span style="color: #000000;">p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i];<br></span><span style="color: #008080;"> 72</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;"> 73</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;"> 74</span> <span style="color: #000000;">            p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">=</span><span style="color: #000000;">p;<br></span><span style="color: #008080;"> 75</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(s</span><span style="color: #000000;">!=</span><span style="color: #000000;">e)<br></span><span style="color: #008080;"> 76</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;"> 77</span> <span style="color: #000000;">        p</span><span style="color: #000000;">=</span><span style="color: #000000;">q[</span><span style="color: #000000;">++</span><span style="color: #000000;">s];<br></span><span style="color: #008080;"> 78</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i</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;">n;i</span><span style="color: #000000;">++</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;">            node </span><span style="color: #000000;">*</span><span style="color: #000000;">pre</span><span style="color: #000000;">=</span><span style="color: #000000;">p</span><span style="color: #000000;">-></span><span style="color: #000000;">pre;<br></span><span style="color: #008080;"> 81</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(pre</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">==</span><span style="color: #000000;">NULL) pre</span><span style="color: #000000;">=</span><span style="color: #000000;">pre</span><span style="color: #000000;">-></span><span style="color: #000000;">pre;<br></span><span style="color: #008080;"> 82</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i])<br></span><span style="color: #008080;"> 83</span> <span style="color: #000000;">            {<br></span><span style="color: #008080;"> 84</span> <span style="color: #000000;">                p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">-></span><span style="color: #000000;">pre</span><span style="color: #000000;">=</span><span style="color: #000000;">pre</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i];<br></span><span style="color: #008080;"> 85</span> <span style="color: #000000;">                p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">-></span><span style="color: #000000;">end</span><span style="color: #000000;">=</span><span style="color: #000000;">(p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">-></span><span style="color: #000000;">pre</span><span style="color: #000000;">-></span><span style="color: #000000;">end</span><span style="color: #000000;">||</span><span style="color: #000000;">p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">-></span><span style="color: #000000;">end);<br></span><span style="color: #008080;"> 86</span> <span style="color: #000000;">                q[</span><span style="color: #000000;">++</span><span style="color: #000000;">e]</span><span style="color: #000000;">=</span><span style="color: #000000;">p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i];<br></span><span style="color: #008080;"> 87</span> <span style="color: #000000;">            }<br></span><span style="color: #008080;"> 88</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;"> 89</span> <span style="color: #000000;">                p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]</span><span style="color: #000000;">=</span><span style="color: #000000;">pre</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i];<br></span><span style="color: #008080;"> 90</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;"> 91</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;"> 92</span> <span style="color: #000000;">}<br></span><span style="color: #008080;"> 93</span> <span style="color: #000000;">BigInteger dp[</span><span style="color: #000000;">200</span><span style="color: #000000;">][</span><span style="color: #000000;">55</span><span style="color: #000000;">],zero,one;<br></span><span style="color: #008080;"> 94</span> <span style="color: #000000;">BigInteger solve(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> s,node </span><span style="color: #000000;">*</span><span style="color: #000000;">p)<br></span><span style="color: #008080;"> 95</span> <span style="color: #000000;">{<br></span><span style="color: #008080;"> 96</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(p</span><span style="color: #000000;">-></span><span style="color: #000000;">end) </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> zero;<br></span><span style="color: #008080;"> 97</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(s</span><span style="color: #000000;">==</span><span style="color: #000000;">m) </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> one;<br></span><span style="color: #008080;"> 98</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">(dp[p</span><span style="color: #000000;">-</span><span style="color: #000000;">buffer][s].init)) </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> dp[p</span><span style="color: #000000;">-</span><span style="color: #000000;">buffer][s];<br></span><span style="color: #008080;"> 99</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;">100</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;">101</span> <span style="color: #000000;">        dp[p</span><span style="color: #000000;">-</span><span style="color: #000000;">buffer][s].init</span><span style="color: #000000;">=</span><span style="color: #0000ff;">false</span><span style="color: #000000;">;<br></span><span style="color: #008080;">102</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i</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;">n;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;">103</span> <span style="color: #000000;">        { <br></span><span style="color: #008080;">104</span> <span style="color: #000000;">            dp[p</span><span style="color: #000000;">-</span><span style="color: #000000;">buffer][s]</span><span style="color: #000000;">=</span><span style="color: #000000;">dp[p</span><span style="color: #000000;">-</span><span style="color: #000000;">buffer][s]</span><span style="color: #000000;">+</span><span style="color: #000000;">solve(s</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">,p</span><span style="color: #000000;">-></span><span style="color: #000000;">nxt[i]);<br></span><span style="color: #008080;">105</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;">106</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> dp[p</span><span style="color: #000000;">-</span><span style="color: #000000;">buffer][s];<br></span><span style="color: #008080;">107</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">108</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;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main()<br></span><span style="color: #008080;">111</span> <span style="color: #000000;">{<br></span><span style="color: #008080;">112</span> <span style="color: #000000;">    cin</span><span style="color: #000000;">>></span><span style="color: #000000;">n</span><span style="color: #000000;">>></span><span style="color: #000000;">m</span><span style="color: #000000;">>></span><span style="color: #000000;">num;<br></span><span style="color: #008080;">113</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">char</span><span style="color: #000000;"> str[</span><span style="color: #000000;">128</span><span style="color: #000000;">];<br></span><span style="color: #008080;">114</span> <span style="color: #000000;">    cin</span><span style="color: #000000;">>></span><span style="color: #000000;">str;<br></span><span style="color: #008080;">115</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> tc</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">116</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;str[i]</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;">;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br></span><span style="color: #008080;">117</span> <span style="color: #000000;">        map[str[i]]</span><span style="color: #000000;">=</span><span style="color: #000000;">tc</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br></span><span style="color: #008080;">118</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(num</span><span style="color: #000000;">--</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;">        cin</span><span style="color: #000000;">>></span><span style="color: #000000;">str;<br></span><span style="color: #008080;">121</span> <span style="color: #000000;">        insert(str);<br></span><span style="color: #008080;">122</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">123</span> <span style="color: #000000;">    make_per();<br></span><span style="color: #008080;">124</span> <span style="color: #000000;">    one.bit[</span><span style="color: #000000;">0</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: #008080;">125</span> <span style="color: #000000;">    solve(</span><span style="color: #000000;">0</span><span style="color: #000000;">,buffer);<br></span><span style="color: #008080;">126</span> <span style="color: #000000;">    dp[</span><span style="color: #000000;">0</span><span style="color: #000000;">][</span><span style="color: #000000;">0</span><span style="color: #000000;">].print();<br></span><span style="color: #008080;">127</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;">128</span> <span style="color: #000000;"><br></span><span style="color: #008080;">129</span> <span style="color: #000000;">}</span></div> <br><br><img src ="http://www.shnenglu.com/yzhw/aggbug/138432.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2011-01-13 09:57 <a href="http://www.shnenglu.com/yzhw/archive/2011/01/13/138432.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pku3691 DNA repair 鑷姩鏈?DPhttp://www.shnenglu.com/yzhw/archive/2011/01/12/138396.htmlyzhwyzhwWed, 12 Jan 2011 05:21:00 GMThttp://www.shnenglu.com/yzhw/archive/2011/01/12/138396.htmlhttp://www.shnenglu.com/yzhw/comments/138396.htmlhttp://www.shnenglu.com/yzhw/archive/2011/01/12/138396.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/138396.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/138396.html闃呰鍏ㄦ枃

yzhw 2011-01-12 13:21 鍙戣〃璇勮
]]>
pku3371 Flesch Reading Ease 瀛楃涓插鐞?/title><link>http://www.shnenglu.com/yzhw/archive/2011/01/06/138090.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Thu, 06 Jan 2011 15:26:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2011/01/06/138090.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/138090.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2011/01/06/138090.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/138090.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/138090.html</trackback:ping><description><![CDATA[     鎽樿: 棰樼洰寰堢綏鍡︼紝璇村埌搴曞共涓変歡浜嬶細1銆佺粺璁″彞瀛愮殑涓暟錛堜互".:;!?"涓哄垎闅旂錛夛紝榪欎釜鍙緇熻鍒嗛殧絎︾殑涓暟鍗沖彲2銆佺粺璁″崟璇嶇殑涓暟錛岃繖涓渶瑕佹敞鎰忎竴鐐癸紝涓嶈兘浠呬粎浠ョ┖鏍兼潵spilt瀛楃涓詫紝鐒跺悗緇熻涓暟鐨勬柟娉曘傘傚彧鏈夐櫎鍘繪爣鐐圭鍙峰悗闈炵┖鐨刾atten鎵嶈兘綆椾竴涓獁ord3銆佺粺璁¢煶鑺傜殑涓暟銆? -es, -ed and -e (except -le) endings are ignored, 錛堟湯灝句互es...  <a href='http://www.shnenglu.com/yzhw/archive/2011/01/06/138090.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/yzhw/aggbug/138090.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2011-01-06 23:26 <a href="http://www.shnenglu.com/yzhw/archive/2011/01/06/138090.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pku 2945 Find the Clones 瀛楃涓瞙ashhttp://www.shnenglu.com/yzhw/archive/2010/12/10/136073.htmlyzhwyzhwFri, 10 Dec 2010 08:55:00 GMThttp://www.shnenglu.com/yzhw/archive/2010/12/10/136073.htmlhttp://www.shnenglu.com/yzhw/comments/136073.htmlhttp://www.shnenglu.com/yzhw/archive/2010/12/10/136073.html#Feedback0http://www.shnenglu.com/yzhw/comments/commentRss/136073.htmlhttp://www.shnenglu.com/yzhw/services/trackbacks/136073.html緇欏嚭n涓瓧絎︿覆錛岀粺璁″嚭鐜?銆?銆?.n嬈$殑瀛楃涓插悇鏈夊灝戠
瑙f硶錛?br>瀛楃涓瞙ash錛屾垜鐢ㄧ殑寮哄ぇ鏃犳瘮鐨凧ava鐨凥ashMap錛岄潪甯哥粰鍔涳綖
浠g爜錛?br>
 1 import java.io.*;
 2 import java.util.*;
 3 public class Main {
 4 
 5     /**
 6      * @param args
 7      */
 8     public static void main(String[] args) throws IOException{
 9         BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
10         HashMap<String,Integer> refer=new HashMap<String,Integer>();
11         int cal[]=new int[20001];
12         while(true)
13         {
14             String tmp[]=in.readLine().split(" ");
15             if(Integer.parseInt(tmp[0])==0&&Integer.parseInt(tmp[1])==0break;
16             int n=Integer.parseInt(tmp[0]);
17             refer.clear();
18             for(int i=0;i<n;i++)
19             {
20                 String str=in.readLine();
21                 if(refer.containsKey(str)) refer.put(str,refer.get(str)+1);
22                 else refer.put(str, 1);
23             }
24             Arrays.fill(cal,0);
25             for(int i:refer.values())
26               cal[i]++;
27             for(int i=1;i<=n;i++)
28                 System.out.println(cal[i]);
29             
30         }
31 
32     }
33 
34 }


yzhw 2010-12-10 16:55 鍙戣〃璇勮
]]>
pku 1226 Substrings 搴旇鐢ㄥ悗緙鏁扮粍銆傘傛垜浜屽垎+鏆村姏鐨勩傘?/title><link>http://www.shnenglu.com/yzhw/archive/2010/12/09/136004.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Thu, 09 Dec 2010 13:09:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2010/12/09/136004.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/136004.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2010/12/09/136004.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/136004.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/136004.html</trackback:ping><description><![CDATA[棰樻剰錛?br>緇欏嚭涓鍫嗗瓧絎︿覆錛岃X涓轟竴涓瓧絎︿覆錛屽叾鏈韓鎴栬呭叾鍙嶈漿浼犲湪姣忎釜瀛楃涓蹭腑鍧囧嚭鐜般傞棶x鐨勬渶闀塊暱搴︺?br>瑙f硶錛?br>鐢變簬鏁版嵁灝忥紝100涓瓧絎︿覆錛屾渶澶ч暱搴︿負100錛屾垜灝辯敤浜嗕簩鍒?鏆村姏鏋氫婦楠岃瘉銆傘?br>浜屽垎瀛楃涓查暱搴︼紝鐒跺悗鏋氫婦鍏朵腑涓涓瓧絎︿覆鐨勮搗濮嬩綅緗畇錛岄獙璇佷互s涓鴻搗濮嬶紝闀垮害涓簂en鐨勫瓧絎︿覆錛堟垨鍏跺弽杞覆錛夋槸鍚﹀湪鎵鏈夊瓧絎︿覆涓兘鍑虹幇錛堣繖姝ュ鏉傚害o(n3))<br>鍔犱笂浜屽垎鐨勫鏉傚害錛屾誨鏉傚害涓簅(n<sup>3</sup>logn)<br>姝hВ搴旇鏄敤鍚庣紑鏁扮粍+浜屽垎銆傚皢鎵鏈夊師涓插拰鍘熶覆鐨勫弽涓茶繛鎺ヨ搗鏉ヨ綆楀悗緙鏁扮粍錛屼簩鍒嗗瓙涓查暱搴︼紝鐒跺悗鐢╤eight鏁扮粍鍒嗙被鏉ラ獙璇併傘傚鏉傚害o(n<sup>2</sup>logn)<br><br>浠g爜錛?br> <div style="BORDER-BOTTOM: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; PADDING-BOTTOM: 4px; BACKGROUND-COLOR: #eeeeee; PADDING-LEFT: 4px; WIDTH: 98%; PADDING-RIGHT: 5px; FONT-SIZE: 13px; WORD-BREAK: break-all; BORDER-TOP: #cccccc 1px solid; BORDER-RIGHT: #cccccc 1px solid; PADDING-TOP: 4px"><span style="COLOR: #008080"> 1</span><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><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"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"># include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cstring</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> str[</span><span style="COLOR: #000000">101</span><span style="COLOR: #000000">][</span><span style="COLOR: #000000">105</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n;<br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> strreverse(</span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">str)<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img id=Codehighlighter1_114_252_Open_Image onclick="this.style.display='none'; Codehighlighter1_114_252_Open_Text.style.display='none'; Codehighlighter1_114_252_Closed_Image.style.display='inline'; Codehighlighter1_114_252_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_114_252_Closed_Image onclick="this.style.display='none'; Codehighlighter1_114_252_Closed_Text.style.display='none'; Codehighlighter1_114_252_Open_Image.style.display='inline'; Codehighlighter1_114_252_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_114_252_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_114_252_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> len</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">strlen(str);<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i</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">2</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img id=Codehighlighter1_171_250_Open_Image onclick="this.style.display='none'; Codehighlighter1_171_250_Open_Text.style.display='none'; Codehighlighter1_171_250_Closed_Image.style.display='inline'; Codehighlighter1_171_250_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_171_250_Closed_Image onclick="this.style.display='none'; Codehighlighter1_171_250_Closed_Text.style.display='none'; Codehighlighter1_171_250_Open_Image.style.display='inline'; Codehighlighter1_171_250_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">   </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_171_250_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_171_250_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> tmp</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">str[i];<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      str[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">str[len</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">i];<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      str[len</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">tmp;<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">   }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000"> chk(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> len,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> pos)<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img id=Codehighlighter1_280_847_Open_Image onclick="this.style.display='none'; Codehighlighter1_280_847_Open_Text.style.display='none'; Codehighlighter1_280_847_Closed_Image.style.display='inline'; Codehighlighter1_280_847_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_280_847_Closed_Image onclick="this.style.display='none'; Codehighlighter1_280_847_Closed_Text.style.display='none'; Codehighlighter1_280_847_Open_Image.style.display='inline'; Codehighlighter1_280_847_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_280_847_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_280_847_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> s</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;s</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">len</span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000">strlen(str[pos]);s</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img id=Codehighlighter1_329_828_Open_Image onclick="this.style.display='none'; Codehighlighter1_329_828_Open_Text.style.display='none'; Codehighlighter1_329_828_Closed_Image.style.display='inline'; Codehighlighter1_329_828_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_329_828_Closed_Image onclick="this.style.display='none'; Codehighlighter1_329_828_Closed_Text.style.display='none'; Codehighlighter1_329_828_Open_Image.style.display='inline'; Codehighlighter1_329_828_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">   </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_329_828_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_329_828_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> tmp</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">str[pos][s</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">len];<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000"> flag</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      str[pos][s</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">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;j</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">n;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img id=Codehighlighter1_447_761_Open_Image onclick="this.style.display='none'; Codehighlighter1_447_761_Open_Text.style.display='none'; Codehighlighter1_447_761_Closed_Image.style.display='inline'; Codehighlighter1_447_761_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_447_761_Closed_Image onclick="this.style.display='none'; Codehighlighter1_447_761_Closed_Text.style.display='none'; Codehighlighter1_447_761_Open_Image.style.display='inline'; Codehighlighter1_447_761_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">      </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_447_761_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_447_761_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">         </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(strstr(str[j],str[pos]</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">s)) </span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">         </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img id=Codehighlighter1_521_753_Open_Image onclick="this.style.display='none'; Codehighlighter1_521_753_Open_Text.style.display='none'; Codehighlighter1_521_753_Closed_Image.style.display='inline'; Codehighlighter1_521_753_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_521_753_Closed_Image onclick="this.style.display='none'; Codehighlighter1_521_753_Closed_Text.style.display='none'; Codehighlighter1_521_753_Open_Image.style.display='inline'; Codehighlighter1_521_753_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">         </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_521_753_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_521_753_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">             strreverse(str[pos]</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">s);<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">             </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">p</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">strstr(str[j],str[pos]</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">s);<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">             strreverse(str[pos]</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">s);<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">             </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">!</span><span style="COLOR: #000000">p)<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img id=Codehighlighter1_678_742_Open_Image onclick="this.style.display='none'; Codehighlighter1_678_742_Open_Text.style.display='none'; Codehighlighter1_678_742_Closed_Image.style.display='inline'; Codehighlighter1_678_742_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_678_742_Closed_Image onclick="this.style.display='none'; Codehighlighter1_678_742_Closed_Text.style.display='none'; Codehighlighter1_678_742_Open_Image.style.display='inline'; Codehighlighter1_678_742_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">             </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_678_742_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_678_742_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">               flag</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">               </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">             }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">         }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">      }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      str[pos][s</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">len]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">tmp;<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(flag) </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      <br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">   }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img id=Codehighlighter1_860_1260_Open_Image onclick="this.style.display='none'; Codehighlighter1_860_1260_Open_Text.style.display='none'; Codehighlighter1_860_1260_Closed_Image.style.display='inline'; Codehighlighter1_860_1260_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_860_1260_Closed_Image onclick="this.style.display='none'; Codehighlighter1_860_1260_Closed_Text.style.display='none'; Codehighlighter1_860_1260_Open_Image.style.display='inline'; Codehighlighter1_860_1260_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif"></span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_860_1260_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_860_1260_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> test;<br></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">test);<br></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(test</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img id=Codehighlighter1_917_1245_Open_Image onclick="this.style.display='none'; Codehighlighter1_917_1245_Open_Text.style.display='none'; Codehighlighter1_917_1245_Closed_Image.style.display='inline'; Codehighlighter1_917_1245_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_917_1245_Closed_Image onclick="this.style.display='none'; Codehighlighter1_917_1245_Closed_Text.style.display='none'; Codehighlighter1_917_1245_Open_Image.style.display='inline'; Codehighlighter1_917_1245_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">   </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_917_1245_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_917_1245_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> s</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">,e</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0xfffffff</span><span style="COLOR: #000000">,pos;<br></span><span style="COLOR: #008080">51</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">n);<br></span><span style="COLOR: #008080">52</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i</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">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">53</span><span style="COLOR: #000000"><img id=Codehighlighter1_1005_1094_Open_Image onclick="this.style.display='none'; Codehighlighter1_1005_1094_Open_Text.style.display='none'; Codehighlighter1_1005_1094_Closed_Image.style.display='inline'; Codehighlighter1_1005_1094_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1005_1094_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1005_1094_Closed_Text.style.display='none'; Codehighlighter1_1005_1094_Open_Image.style.display='inline'; Codehighlighter1_1005_1094_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">      </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1005_1094_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1005_1094_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">54</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%s</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,str[i]);<br></span><span style="COLOR: #008080">55</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(strlen(str[i])</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">e) e</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">strlen(str[i]),pos</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">i;<br></span><span style="COLOR: #008080">56</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">      }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">57</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(s</span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000">e)<br></span><span style="COLOR: #008080">58</span><span style="COLOR: #000000"><img id=Codehighlighter1_1120_1213_Open_Image onclick="this.style.display='none'; Codehighlighter1_1120_1213_Open_Text.style.display='none'; Codehighlighter1_1120_1213_Closed_Image.style.display='inline'; Codehighlighter1_1120_1213_Closed_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="DISPLAY: none" id=Codehighlighter1_1120_1213_Closed_Image onclick="this.style.display='none'; Codehighlighter1_1120_1213_Closed_Text.style.display='none'; Codehighlighter1_1120_1213_Open_Image.style.display='inline'; Codehighlighter1_1120_1213_Open_Text.style.display='inline';" align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif">      </span><span style="BORDER-BOTTOM: #808080 1px solid; BORDER-LEFT: #808080 1px solid; BACKGROUND-COLOR: #ffffff; DISPLAY: none; BORDER-TOP: #808080 1px solid; BORDER-RIGHT: #808080 1px solid" id=Codehighlighter1_1120_1213_Closed_Text><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_1120_1213_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">59</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">         </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> mid</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">(s</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">e)</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">60</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">         </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(chk(mid,pos)) s</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">mid</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">61</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">         </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"> e</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">mid</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">62</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">      }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">63</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">      printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,s</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br></span><span style="COLOR: #008080">64</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif">   }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">65</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif">   </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">66</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif">}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">67</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"><br></span><span style="COLOR: #008080">68</span><span style="COLOR: #000000"><img align=top src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif"></span></div> <img src ="http://www.shnenglu.com/yzhw/aggbug/136004.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2010-12-09 21:09 <a href="http://www.shnenglu.com/yzhw/archive/2010/12/09/136004.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>fzu 2005 Computer Virus on Planet Pandora (The 35th ACM/ICPC Asia Regional Fuzhou Site) AC鑷姩鏈?/title><link>http://www.shnenglu.com/yzhw/archive/2010/12/07/135634.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Mon, 06 Dec 2010 17:36:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2010/12/07/135634.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/135634.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2010/12/07/135634.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/135634.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/135634.html</trackback:ping><description><![CDATA[     鎽樿: 棰樻剰錛氱粰鍑轟竴浜涚梾姣掔殑鐗瑰緛涓詫紝濡傛灉涓涓▼搴忥紙鎴栬呭皢紼嬪簭鍙嶈漿錛変腑鍑虹幇浜嗘煇涓梾姣掔殑鐗瑰緛涓詫紝鍒欒紼嬪簭琚繖涓梾姣掓劅鏌撲簡銆傜粰鍑鴻嫢騫茬梾姣掍覆錛屼竴涓▼搴忎覆錛岄棶鏀圭▼搴忚澶氬皯縐嶇梾姣掓劅鏌撲簡錛熻В娉曪細姣旇禌鐨勬椂鍊欐ā鏉挎湁bug錛學A鍒版錛岀珶鐒惰繖涓敤浜嗘暟鏈堢殑妯℃澘涔嬪墠榪樼濂囩殑閫氳繃浜哊閬撹嚜鍔ㄦ満鐨勯鐩紝涓嶅彲鎬濊銆傘備竴閬撻潪甯歌8鐨勮嚜鍔ㄦ満錛屽皢紼嬪簭涓叉鍙嶅尮閰嶄竴閬嶆棦寰楃瓟妗堛傝嚜鍔ㄦ満鑺傜偣緇撴瀯濡備笅錛?Code highlighting produce...  <a href='http://www.shnenglu.com/yzhw/archive/2010/12/07/135634.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/yzhw/aggbug/135634.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2010-12-07 01:36 <a href="http://www.shnenglu.com/yzhw/archive/2010/12/07/135634.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>hdu 3374 String Problem 瀛楃涓叉渶灝忋佹渶澶ц〃紺轟互鍙婂瓧涓查噸澶嶆鏁幫紙KMP錛?/title><link>http://www.shnenglu.com/yzhw/archive/2010/11/27/134851.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Sat, 27 Nov 2010 13:06:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2010/11/27/134851.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/134851.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2010/11/27/134851.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/134851.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/134851.html</trackback:ping><description><![CDATA[棰樻剰錛?br>緇欏嚭涓涓瓧絎︿覆錛屾眰鍏舵墍鏈夊驚鐜悓鏋勪覆涓瓧鍏稿簭鏈澶х殑涓蹭互鍙婃渶灝忕殑涓層傚茍涓旇綆楄繖涓や釜涓插湪鎵鏈夊驚鐜悓鏋勪覆涓嚭鐜扮殑嬈℃暟<br><br>瑙f硶錛?br>絎竴闂紝鐢ㄧ粡鍏哥殑姹備覆鐨勬渶灝忚〃紺虹殑綆楁硶灝卞彲浠ヤ簡銆?br>絎簩闂紝鍒╃敤KMP綆楁硶鍓嶇紑鏁扮粍鐨勬ц川錛屽嵆鏈澶у悗緙絳変簬鏈闀垮墠緙鐨勪綅緗備粠鏈灝忚〃紺猴紙鏈澶ц〃紺猴級鐨勪綅緗紑濮嬭綆梟ext鍑芥暟錛屽皢start+len-1浣嶇疆浣滃悎娉曟爣蹇楋紝璁$畻nxt鏁扮粍鐨勬椂鍊欓『渚胯綆楁爣璁幫紙涓嶢C鑷姩鏈烘柟娉曠浉鍚岋級錛岀劧鍚庣粺璁℃爣璁頒釜鏁板嵆鍙綖<br><br>浠g爜錛氾紙GCC錛?br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<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: #0000ff;">string</span><span style="color: #000000;">.h</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;">stdio.h</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;">stdbool.h</span><span style="color: #000000;">></span><span style="color: #000000;"><br></span><span style="color: #008080;"> 4</span> <span style="color: #000000;"></span><span style="color: #0000ff;">char</span><span style="color: #000000;"> str[</span><span style="color: #000000;">2050000</span><span style="color: #000000;">];<br></span><span style="color: #008080;"> 5</span> <span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> pre[</span><span style="color: #000000;">2050000</span><span style="color: #000000;">];<br></span><span style="color: #008080;"> 6</span> <span style="color: #000000;"></span><span style="color: #0000ff;">bool</span><span style="color: #000000;"> end[</span><span style="color: #000000;">2050000</span><span style="color: #000000;">];<br></span><span style="color: #008080;"> 7</span> <span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> maxpos(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> len)<br></span><span style="color: #008080;"> 8</span> <span style="color: #000000;">{<br></span><span style="color: #008080;"> 9</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> p1</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">,p2</span><span style="color: #000000;">=</span><span style="color: #000000;">1</span><span style="color: #000000;">,l</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">,i;<br></span><span style="color: #008080;">10</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(p1</span><span style="color: #000000;"><</span><span style="color: #000000;">len</span><span style="color: #000000;">&&</span><span style="color: #000000;">p2</span><span style="color: #000000;"><</span><span style="color: #000000;">len</span><span style="color: #000000;">&&</span><span style="color: #000000;">l</span><span style="color: #000000;"><</span><span style="color: #000000;">len)<br></span><span style="color: #008080;">11</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;">12</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> cmp</span><span style="color: #000000;">=</span><span style="color: #000000;">str[p1</span><span style="color: #000000;">+</span><span style="color: #000000;">l]</span><span style="color: #000000;">-</span><span style="color: #000000;">str[p2</span><span style="color: #000000;">+</span><span style="color: #000000;">l];<br></span><span style="color: #008080;">13</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">cmp)<br></span><span style="color: #008080;">14</span> <span style="color: #000000;">             l</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br></span><span style="color: #008080;">15</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">else</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;">if</span><span style="color: #000000;">(cmp</span><span style="color: #000000;"><</span><span style="color: #000000;">0</span><span style="color: #000000;">) p1</span><span style="color: #000000;">+=</span><span style="color: #000000;">l</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">18</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> p2</span><span style="color: #000000;">+=</span><span style="color: #000000;">l</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">19</span> <span style="color: #000000;">            l</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">20</span> <span style="color: #000000;">            p2</span><span style="color: #000000;">+=</span><span style="color: #000000;">(p2</span><span style="color: #000000;">==</span><span style="color: #000000;">p1);<br></span><span style="color: #008080;">21</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;">22</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">23</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> p1</span><span style="color: #000000;"><</span><span style="color: #000000;">p2</span><span style="color: #000000;">?</span><span style="color: #000000;">p1:p2;<br></span><span style="color: #008080;">24</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;"> minpos(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> len)<br></span><span style="color: #008080;">26</span> <span style="color: #000000;">{<br></span><span style="color: #008080;">27</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> p1</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">,p2</span><span style="color: #000000;">=</span><span style="color: #000000;">1</span><span style="color: #000000;">,l</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">,i;<br></span><span style="color: #008080;">28</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(p1</span><span style="color: #000000;"><</span><span style="color: #000000;">len</span><span style="color: #000000;">&&</span><span style="color: #000000;">p2</span><span style="color: #000000;"><</span><span style="color: #000000;">len</span><span style="color: #000000;">&&</span><span style="color: #000000;">l</span><span style="color: #000000;"><</span><span style="color: #000000;">len)<br></span><span style="color: #008080;">29</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;">30</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> cmp</span><span style="color: #000000;">=</span><span style="color: #000000;">str[p1</span><span style="color: #000000;">+</span><span style="color: #000000;">l]</span><span style="color: #000000;">-</span><span style="color: #000000;">str[p2</span><span style="color: #000000;">+</span><span style="color: #000000;">l];<br></span><span style="color: #008080;">31</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(</span><span style="color: #000000;">!</span><span style="color: #000000;">cmp)<br></span><span style="color: #008080;">32</span> <span style="color: #000000;">             l</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br></span><span style="color: #008080;">33</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;">34</span> <span style="color: #000000;">        {<br></span><span style="color: #008080;">35</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(cmp</span><span style="color: #000000;">></span><span style="color: #000000;">0</span><span style="color: #000000;">) p1</span><span style="color: #000000;">+=</span><span style="color: #000000;">l</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">36</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> p2</span><span style="color: #000000;">+=</span><span style="color: #000000;">l</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">37</span> <span style="color: #000000;">            l</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">38</span> <span style="color: #000000;">            p2</span><span style="color: #000000;">+=</span><span style="color: #000000;">(p2</span><span style="color: #000000;">==</span><span style="color: #000000;">p1);<br></span><span style="color: #008080;">39</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;">40</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">41</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> p1</span><span style="color: #000000;"><</span><span style="color: #000000;">p2</span><span style="color: #000000;">?</span><span style="color: #000000;">p1:p2;<br></span><span style="color: #008080;">42</span> <span style="color: #000000;">}<br></span><span style="color: #008080;">43</span> <span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> gettimes(</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> start,</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> len)<br></span><span style="color: #008080;">44</span> <span style="color: #000000;">{<br></span><span style="color: #008080;">45</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> p,res</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">46</span> <span style="color: #000000;">    memset(end,</span><span style="color: #000000;">0</span><span style="color: #000000;">,</span><span style="color: #0000ff;">sizeof</span><span style="color: #000000;">(end));<br></span><span style="color: #008080;">47</span> <span style="color: #000000;">    end[start</span><span style="color: #000000;">+</span><span style="color: #000000;">len</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;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">48</span> <span style="color: #000000;">    pre[start]</span><span style="color: #000000;">=</span><span style="color: #000000;">start</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">49</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(p</span><span style="color: #000000;">=</span><span style="color: #000000;">start</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;p</span><span style="color: #000000;"><</span><span style="color: #000000;">2</span><span style="color: #000000;">*</span><span style="color: #000000;">len</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">;p</span><span style="color: #000000;">++</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;">        pre[p]</span><span style="color: #000000;">=</span><span style="color: #000000;">pre[p</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">];<br></span><span style="color: #008080;">52</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(pre[p]</span><span style="color: #000000;">!=</span><span style="color: #000000;">start</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">&&</span><span style="color: #000000;">str[pre[p]</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;">str[p]) pre[p]</span><span style="color: #000000;">=</span><span style="color: #000000;">pre[pre[p]];<br></span><span style="color: #008080;">53</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(str[pre[p]</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;">str[p]) pre[p]</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br></span><span style="color: #008080;">54</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(pre[p]</span><span style="color: #000000;">!=</span><span style="color: #000000;">start</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">&&!</span><span style="color: #000000;">end[p]) end[p]</span><span style="color: #000000;">=</span><span style="color: #000000;">end[pre[p]];<br></span><span style="color: #008080;">55</span> <span style="color: #000000;">        res</span><span style="color: #000000;">+=</span><span style="color: #000000;">end[p];<br></span><span style="color: #008080;">56</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">57</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> res;<br></span><span style="color: #008080;">58</span> <span style="color: #000000;">}<br></span><span style="color: #008080;">59</span> <span style="color: #000000;"></span><span style="color: #0000ff;">int</span><span style="color: #000000;"> main()<br></span><span style="color: #008080;">60</span> <span style="color: #000000;">{<br></span><span style="color: #008080;">61</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(gets(str))<br></span><span style="color: #008080;">62</span> <span style="color: #000000;">    {<br></span><span style="color: #008080;">63</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> len</span><span style="color: #000000;">=</span><span style="color: #000000;">strlen(str),i;<br></span><span style="color: #008080;">64</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">for</span><span style="color: #000000;">(i</span><span style="color: #000000;">=</span><span style="color: #000000;">len;i</span><span style="color: #000000;"><</span><span style="color: #000000;">2</span><span style="color: #000000;">*</span><span style="color: #000000;">len</span><span style="color: #000000;">-</span><span style="color: #000000;">1</span><span style="color: #000000;">;i</span><span style="color: #000000;">++</span><span style="color: #000000;">) str[i]</span><span style="color: #000000;">=</span><span style="color: #000000;">str[i</span><span style="color: #000000;">-</span><span style="color: #000000;">len];<br></span><span style="color: #008080;">65</span> <span style="color: #000000;">        str[</span><span style="color: #000000;">2</span><span style="color: #000000;">*</span><span style="color: #000000;">len</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;">\0</span><span style="color: #000000;">'</span><span style="color: #000000;">;<br></span><span style="color: #008080;">66</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> p1</span><span style="color: #000000;">=</span><span style="color: #000000;">minpos(len);<br></span><span style="color: #008080;">67</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> t1</span><span style="color: #000000;">=</span><span style="color: #000000;">gettimes(p1,len);<br></span><span style="color: #008080;">68</span> <span style="color: #000000;">        printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d %d </span><span style="color: #000000;">"</span><span style="color: #000000;">,p1</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">,t1);<br></span><span style="color: #008080;">69</span> <span style="color: #000000;">        p1</span><span style="color: #000000;">=</span><span style="color: #000000;">maxpos(len);<br></span><span style="color: #008080;">70</span> <span style="color: #000000;">        t1</span><span style="color: #000000;">=</span><span style="color: #000000;">gettimes(p1,len);<br></span><span style="color: #008080;">71</span> <span style="color: #000000;">        printf(</span><span style="color: #000000;">"</span><span style="color: #000000;">%d %d\n</span><span style="color: #000000;">"</span><span style="color: #000000;">,p1</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">,t1);<br></span><span style="color: #008080;">72</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">73</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;">74</span> <span style="color: #000000;">}<br></span><span style="color: #008080;">75</span> <span style="color: #000000;"></span></div> <br><br><img src ="http://www.shnenglu.com/yzhw/aggbug/134851.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2010-11-27 21:06 <a href="http://www.shnenglu.com/yzhw/archive/2010/11/27/134851.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>pku 1509 Glass Beads 瀛楃涓茬殑鏈灝忚〃紺?/title><link>http://www.shnenglu.com/yzhw/archive/2010/11/27/134847.html</link><dc:creator>yzhw</dc:creator><author>yzhw</author><pubDate>Sat, 27 Nov 2010 11:59:00 GMT</pubDate><guid>http://www.shnenglu.com/yzhw/archive/2010/11/27/134847.html</guid><wfw:comment>http://www.shnenglu.com/yzhw/comments/134847.html</wfw:comment><comments>http://www.shnenglu.com/yzhw/archive/2010/11/27/134847.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/yzhw/comments/commentRss/134847.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/yzhw/services/trackbacks/134847.html</trackback:ping><description><![CDATA[鎶婁竴涓暱涓簂en鐨勫瓧絎︿覆鍥存垚涓涓湀錛岀劧鍚庝互浠繪剰涓涓瓧絎︿綔涓鴻搗鐐癸紝閮戒細浜х敓涓涓柊鐨勯暱涓簂en鐨勫瓧絎︿覆錛屽瓧絎︿覆鐨勬渶灝忚〃紺哄氨鏄墍鏈夋柊瀛楃涓蹭腑瀛楀吀搴忔渶灝忕殑閭d釜銆?br>涓嬮潰榪欎釜鍑芥暟灝辨槸瑙e喅榪欎釜闂鐨勶紝榪斿洖鍊間負瀛楀吀搴忔渶灝忕殑涓茬殑鍦ㄥ師涓蹭腑鐨勮搗濮嬩綅緗?br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<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: #0000ff;">int</span><span style="color: #000000;"> MinimumRepresentation(</span><span style="color: #0000ff;">char</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">s,</span><span style="color: #0000ff;">int</span><span style="color: #000000;"> l)</span><span style="color: #008000;">//</span><span style="color: #008000;">涓瞫[0~l-1]鐨勬渶灝忚〃紺轟綅緗?/span><span style="color: #008000;"><br></span><span style="color: #008080;"> 2</span> <span style="color: #008000;"></span><span style="color: #000000;">{<br></span><span style="color: #008080;"> 3</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> i </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">, j </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">1</span><span style="color: #000000;">, k </span><span style="color: #000000;">=</span><span style="color: #000000;"> </span><span style="color: #000000;">0</span><span style="color: #000000;">,t;<br></span><span style="color: #008080;"> 4</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">while</span><span style="color: #000000;"> (i </span><span style="color: #000000;"><</span><span style="color: #000000;"> l </span><span style="color: #000000;">&&</span><span style="color: #000000;"> j </span><span style="color: #000000;"><</span><span style="color: #000000;"> l </span><span style="color: #000000;">&&</span><span style="color: #000000;"> k </span><span style="color: #000000;"><</span><span style="color: #000000;"> l)</span><span style="color: #008000;">//</span><span style="color: #008000;">鎵句笉鍒版瘮瀹冭繕灝忕殑 鎴栬?nbsp;瀹屽叏鍖歸厤</span><span style="color: #008000;"><br></span><span style="color: #008080;"> 5</span> <span style="color: #008000;"></span><span style="color: #000000;">    {<br></span><span style="color: #008080;"> 6</span> <span style="color: #000000;">        t </span><span style="color: #000000;">=</span><span style="color: #000000;"> s[(i</span><span style="color: #000000;">+</span><span style="color: #000000;">k)</span><span style="color: #000000;">%</span><span style="color: #000000;">l] </span><span style="color: #000000;">-</span><span style="color: #000000;"> s[(j</span><span style="color: #000000;">+</span><span style="color: #000000;">k)</span><span style="color: #000000;">%</span><span style="color: #000000;">l];<br></span><span style="color: #008080;"> 7</span> <span style="color: #000000;">        </span><span style="color: #008000;">//</span><span style="color: #008000;">if (s[(i+k) >= l ? i+k-l : i+k] == s[(j+k) >= l ? j+k-l : j+k])</span><span style="color: #008000;"><br></span><span style="color: #008080;"> 8</span> <span style="color: #008000;"></span><span style="color: #000000;">        </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (t </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: #008080;"> 9</span> <span style="color: #000000;">            k</span><span style="color: #000000;">++</span><span style="color: #000000;">;</span><span style="color: #008000;">//</span><span style="color: #008000;">鐩哥瓑鐨勮瘽,媯嫻嬮暱搴﹀姞1</span><span style="color: #008000;"><br></span><span style="color: #008080;">10</span> <span style="color: #008000;"></span><span style="color: #000000;">        </span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;">11</span> <span style="color: #000000;">        {<br></span><span style="color: #008080;">12</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (t </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: #008000;">//</span><span style="color: #008000;">澶т簬鐨勮瘽,s[i]涓洪鐨勮偗瀹氫笉鏄渶灝忚〃紺?鏈澶ц〃紺哄氨鏀?lt;</span><span style="color: #008000;"><br></span><span style="color: #008080;">13</span> <span style="color: #008000;"></span><span style="color: #000000;">                i </span><span style="color: #000000;">+=</span><span style="color: #000000;"> k </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: #008080;">14</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br></span><span style="color: #008080;">15</span> <span style="color: #000000;">                j </span><span style="color: #000000;">+=</span><span style="color: #000000;"> k </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: #008080;">16</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">if</span><span style="color: #000000;"> (i </span><span style="color: #000000;">==</span><span style="color: #000000;"> j)<br></span><span style="color: #008080;">17</span> <span style="color: #000000;">                j</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br></span><span style="color: #008080;">18</span> <span style="color: #000000;">            k </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: #008080;">19</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;">20</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">21</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> min(i,j);<br></span><span style="color: #008080;">22</span> <span style="color: #000000;">}</span></div> 鍩烘湰鎯蟲硶灝辨槸涓や釜浣嶇疆鐨勫瓧絎︽瘮杈冿紝濡傛灉s[i+k] > s[j+k]閭d箞i鍒癷+k浣嶇疆閮戒笉鏄渶灝忚〃紺虹殑浣嶇疆錛屾墍浠鐩存帴璺砶+1姝ワ紝鍙嶄箣j鐩存帴璺砶+1姝ャ?br>鏈浠g爜錛?br> <div style="background-color: #eeeeee; font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%;"><!--<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: #0000ff;">import</span><span style="color: #000000;"> java.io.</span><span style="color: #000000;">*</span><span style="color: #000000;">;<br></span><span style="color: #008080;"> 2</span> <span style="color: #000000;"></span><span style="color: #0000ff;">public</span><span style="color: #000000;"> </span><span style="color: #0000ff;">class</span><span style="color: #000000;"> Main {<br></span><span style="color: #008080;"> 3</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">static</span><span style="color: #000000;"> </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> minpos(String str)<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;">int</span><span style="color: #000000;"> p1</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">,p2</span><span style="color: #000000;">=</span><span style="color: #000000;">1</span><span style="color: #000000;">,len</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;"> 6</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">while</span><span style="color: #000000;">(p1</span><span style="color: #000000;"><</span><span style="color: #000000;">str.length()</span><span style="color: #000000;">&&</span><span style="color: #000000;">p2</span><span style="color: #000000;"><</span><span style="color: #000000;">str.length()</span><span style="color: #000000;">&&</span><span style="color: #000000;">len</span><span style="color: #000000;"><</span><span style="color: #000000;">str.length())<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;">int</span><span style="color: #000000;"> res</span><span style="color: #000000;">=</span><span style="color: #000000;">str.charAt((p1</span><span style="color: #000000;">+</span><span style="color: #000000;">len)</span><span style="color: #000000;">%</span><span style="color: #000000;">str.length())</span><span style="color: #000000;">-</span><span style="color: #000000;">str.charAt((p2</span><span style="color: #000000;">+</span><span style="color: #000000;">len)</span><span style="color: #000000;">%</span><span style="color: #000000;">str.length());<br></span><span style="color: #008080;"> 9</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">if</span><span style="color: #000000;">(res</span><span style="color: #000000;">==</span><span style="color: #000000;">0</span><span style="color: #000000;">)<br></span><span style="color: #008080;">10</span> <span style="color: #000000;">                len</span><span style="color: #000000;">++</span><span style="color: #000000;">;<br></span><span style="color: #008080;">11</span> <span style="color: #000000;">            </span><span style="color: #0000ff;">else</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;">(res</span><span style="color: #000000;">></span><span style="color: #000000;">0</span><span style="color: #000000;">) p1</span><span style="color: #000000;">+=</span><span style="color: #000000;">len</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;</span><span style="color: #008000;">//</span><span style="color: #008000;">濡傛灉鏄渶澶ц〃紺猴紝鍒檖2+=len+1錛屼笅闈害鍙?/span><span style="color: #008000;"><br></span><span style="color: #008080;">14</span> <span style="color: #008000;"></span><span style="color: #000000;">                </span><span style="color: #0000ff;">else</span><span style="color: #000000;"> p2</span><span style="color: #000000;">+=</span><span style="color: #000000;">len</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">15</span> <span style="color: #000000;">                len</span><span style="color: #000000;">=</span><span style="color: #000000;">0</span><span style="color: #000000;">;<br></span><span style="color: #008080;">16</span> <span style="color: #000000;">                p2</span><span style="color: #000000;">=</span><span style="color: #000000;">p2</span><span style="color: #000000;">+</span><span style="color: #000000;">(p1</span><span style="color: #000000;">==</span><span style="color: #000000;">p2</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;">17</span> <span style="color: #000000;">            }<br></span><span style="color: #008080;">18</span> <span style="color: #000000;">        }<br></span><span style="color: #008080;">19</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">return</span><span style="color: #000000;"> Math.min(p1, p2)</span><span style="color: #000000;">+</span><span style="color: #000000;">1</span><span style="color: #000000;">;<br></span><span style="color: #008080;">20</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">21</span> <span style="color: #000000;">    </span><span style="color: #0000ff;">public</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;"> main(String[] args) </span><span style="color: #0000ff;">throws</span><span style="color: #000000;"> IOException{<br></span><span style="color: #008080;">22</span> <span style="color: #000000;">        BufferedReader in</span><span style="color: #000000;">=</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> BufferedReader(</span><span style="color: #0000ff;">new</span><span style="color: #000000;"> InputStreamReader(System.in));<br></span><span style="color: #008080;">23</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">int</span><span style="color: #000000;"> test</span><span style="color: #000000;">=</span><span style="color: #000000;">Integer.parseInt(in.readLine());<br></span><span style="color: #008080;">24</span> <span style="color: #000000;">        </span><span style="color: #0000ff;">while</span><span style="color: #000000;">((test</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: #008080;">25</span> <span style="color: #000000;">            System.out.println(minpos(in.readLine()));<br></span><span style="color: #008080;">26</span> <span style="color: #000000;">    }<br></span><span style="color: #008080;">27</span> <span style="color: #000000;"><br></span><span style="color: #008080;">28</span> <span style="color: #000000;">}<br></span><span style="color: #008080;">29</span> <span style="color: #000000;"></span></div> <br> <img src ="http://www.shnenglu.com/yzhw/aggbug/134847.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/yzhw/" target="_blank">yzhw</a> 2010-11-27 19:59 <a href="http://www.shnenglu.com/yzhw/archive/2010/11/27/134847.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.y7114.cn" target="_blank">亚洲欧洲日产国码无码久久99</a>| <a href="http://www.020rj.cn" target="_blank">久久www免费人成看片</a>| <a href="http://www.inconfont.cn" target="_blank">波多野结衣久久一区二区</a>| <a href="http://www.kaoyanonline.cn" target="_blank">国产精品国色综合久久</a>| <a href="http://www.dl-dr.cn" target="_blank">色欲久久久天天天综合网精品</a>| <a href="http://www.21gou.cn" target="_blank">久久国产劲爆AV内射—百度</a>| <a href="http://www.gzfbn.cn" target="_blank">久久人妻AV中文字幕</a>| <a href="http://www.qwqsd.cn" target="_blank">久久婷婷色香五月综合激情</a>| <a href="http://www.shecb2b.com.cn" target="_blank">看全色黄大色大片免费久久久</a>| <a href="http://www.vocard.cn" target="_blank">曰曰摸天天摸人人看久久久</a>| <a href="http://www.dxctutor.cn" target="_blank">国产精品久久久久乳精品爆 </a>| <a href="http://www.todouba.cn" target="_blank">精品蜜臀久久久久99网站</a>| <a href="http://www.transeurope.com.cn" target="_blank">中文国产成人精品久久亚洲精品AⅤ无码精品 </a>| <a href="http://www.nthaixin.com.cn" target="_blank">国产综合免费精品久久久</a>| <a href="http://www.hjj9588.cn" target="_blank">99国内精品久久久久久久</a>| <a href="http://www.gmxd.net.cn" target="_blank">99久久精品免费看国产免费</a>| <a href="http://www.fyjzhxf.cn" target="_blank">久久WWW免费人成—看片</a>| <a href="http://www.baby-bib.cn" target="_blank">精品乱码久久久久久夜夜嗨</a>| <a href="http://www.818wg.cn" target="_blank">亚洲国产精品成人久久蜜臀 </a>| <a href="http://www.qvuavh.cn" target="_blank">国产精品成人99久久久久 </a>| <a href="http://www.jinshengsuliao.cn" target="_blank">久久国产精品77777</a>| <a href="http://www.jisuxb.cn" target="_blank">久久国产精品久久精品国产</a>| <a href="http://www.reln.cn" target="_blank">国产精品熟女福利久久AV</a>| <a href="http://www.hgysc.cn" target="_blank">久久综合给合综合久久</a>| <a href="http://www.ziximaker.cn" target="_blank">久久精品国产亚洲AV影院</a>| <a href="http://www.congress-gsc.cn" target="_blank">久久ZYZ资源站无码中文动漫 </a>| <a href="http://www.bassaphoto.cn" target="_blank">国产精品成人99久久久久 </a>| <a href="http://www.zpktv.cn" target="_blank">久久久久久曰本AV免费免费</a>| <a href="http://www.c-c-city.com.cn" target="_blank">久久九九久精品国产免费直播</a>| <a href="http://www.114tmall.cn" target="_blank">色88久久久久高潮综合影院</a>| <a href="http://www.ems1.cn" target="_blank">91精品国产91久久久久久蜜臀</a>| <a href="http://www.yaott2.cn" target="_blank">亚洲国产一成久久精品国产成人综合 </a>| <a href="http://www.xiguayo.cn" target="_blank">欧美伊香蕉久久综合类网站</a>| <a href="http://www.aylzys.cn" target="_blank">国产一区二区精品久久岳</a>| <a href="http://www.168sf.com.cn" target="_blank">99久久国产亚洲综合精品</a>| <a href="http://www.uywz.cn" target="_blank">久久久久夜夜夜精品国产</a>| <a href="http://www.lntyzx.com.cn" target="_blank">女同久久</a>| <a href="http://www.kdplastics.cn" target="_blank">久久国产精品成人免费</a>| <a href="http://www.gdlj2004.cn" target="_blank">久久婷婷五月综合成人D啪 </a>| <a href="http://www.javareport.cn" target="_blank">成人妇女免费播放久久久</a>| <a href="http://www.wordboy.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>