锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲Av无码国产情品久久,国产综合免费精品久久久,国产成人精品免费久久久久http://www.shnenglu.com/cjz/category/6027.html......zh-cnWed, 21 May 2008 11:42:43 GMTWed, 21 May 2008 11:42:43 GMT60[ACM 1040] 鍑戣〃杈懼紡http://www.shnenglu.com/cjz/archive/2008/05/12/49653.html椋涘ぉ椋涘ぉMon, 12 May 2008 10:02:00 GMThttp://www.shnenglu.com/cjz/archive/2008/05/12/49653.htmlhttp://www.shnenglu.com/cjz/comments/49653.htmlhttp://www.shnenglu.com/cjz/archive/2008/05/12/49653.html#Feedback0http://www.shnenglu.com/cjz/comments/commentRss/49653.htmlhttp://www.shnenglu.com/cjz/services/trackbacks/49653.html鍑戣〃杈懼紡
Time Limit:1000MS  Memory Limit:32768K

Description:

鏈変竴浜涙暣鏁扮粍錛屾瘡涓変釜鏁版垚涓緇勩傚鏋滀笁涓暟緇忚繃鍥涘垯榪愮畻(+銆?銆?#215;銆?#247;)寰楀嚭緇撴灉0錛屽垯杈撳嚭“yes”錛屽惁鍒欒緭鍑?#8220;no”銆傚綋涓変釜鏁頒負(fù)鍏?鏃惰〃紺鴻緭鍏ョ粨鏉熴?

Sample Input:

1 2 3
3 8 10
100 210 7
900 1 0
0銆0銆0

Sample Output:

yes
no
no
yes
================================================================================
鎻愪氦娌掓湁鎴愬姛
#include <cstdlib>
#include 
<iostream>

using namespace std;
#define MAX_ROW 50

string out[MAX_ROW];
int num[MAX_ROW][3];
int index=0;

void output()
{
       
for(int i=0;i<index;++i)
       
{
          cout
<<out[i].c_str();
          cout
<<endl;
       }

}
   //娣辨悳鐩村埌絎笁灞わ紝鍒ゆ柗鍊兼槸鍚︾偤0
bool dfs(float number,int n)
{
    
if(n>=3
        
return number==0;
    
if(dfs(number+num[index][n],n+1)) return true;
    
if(dfs(number-num[index][n],n+1)) return true;
    
if(dfs(number*num[index][n],n+1)) return true;
    
if(dfs(number/num[index][n],n+1)) return true;  
    
return false;    
}
   
int main(int argc, char *argv[])
{
   
    
while(1)
    
{
     
for(int i=0;i<3;++i)
             cin
>>num[index][i];
     
if(num[index][0]==0&&
       num[index][
1]==0&&
         num[index][
2]==0)
         
{
             
break;              
         }

         
       
if(dfs(num[index][0],1)) out[index]="yes";
       
else out[index]="no";
       index
++;
     }

    
    output();  
    system(
"PAUSE");
    
return 0;
}





椋涘ぉ 2008-05-12 18:02 鍙戣〃璇勮
]]>
[ACM 1015] 緇勫悎鏁扮畻娉?/title><link>http://www.shnenglu.com/cjz/archive/2008/01/26/41936.html</link><dc:creator>椋涘ぉ</dc:creator><author>椋涘ぉ</author><pubDate>Sat, 26 Jan 2008 06:39:00 GMT</pubDate><guid>http://www.shnenglu.com/cjz/archive/2008/01/26/41936.html</guid><wfw:comment>http://www.shnenglu.com/cjz/comments/41936.html</wfw:comment><comments>http://www.shnenglu.com/cjz/archive/2008/01/26/41936.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cjz/comments/commentRss/41936.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cjz/services/trackbacks/41936.html</trackback:ping><description><![CDATA[<p align=center><font color=blue size=5>綆鍗曠殑浜嬫儏</font> <br>Time Limit:1000MS  Memory Limit:32768K<br></p> <div align=left> <h3>Description:</h3> 鏁板澶╂墠fans鏇劇粡璇磋繃涓鍙ヨ瘽錛氱粍鍚堟暟鐨勮綆楁槸涓浠墮潪甯哥畝鍗曠殑浜嬫儏銆傜粍鍚堟暟鐨勮綆楃湡鐨勬槸涓浠墮潪甯哥畝鍗曠殑浜嬫儏鍚楋紵璇蜂綘鑷繁鍘誨皾璇曚竴涓嬪惂錛? <p> <h3>Input:</h3> 杈撳叆涓殑涓浜涙暣鏁板n錛宮錛坢≤n≤20錛? <h3>Output:</h3> 杈撳嚭鍏剁粍鍚堟暟銆? <h3>Sample Input:</h3> <pre>5 2 18 13 </pre> <h3>Sample Output:</h3> <pre>10 8568</pre> </div> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">vector</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> num;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> m,n;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> sum</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>             <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> dfs(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> subtree,</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> level)<br><img id=Codehighlighter1_200_541_Open_Image onclick="this.style.display='none'; Codehighlighter1_200_541_Open_Text.style.display='none'; Codehighlighter1_200_541_Closed_Image.style.display='inline'; Codehighlighter1_200_541_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_200_541_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_200_541_Closed_Text.style.display='none'; Codehighlighter1_200_541_Open_Image.style.display='inline'; Codehighlighter1_200_541_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_200_541_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_200_541_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>     <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   </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">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(level</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">n)<br><img id=Codehighlighter1_239_311_Open_Image onclick="this.style.display='none'; Codehighlighter1_239_311_Open_Text.style.display='none'; Codehighlighter1_239_311_Closed_Image.style.display='inline'; Codehighlighter1_239_311_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_239_311_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_239_311_Closed_Text.style.display='none'; Codehighlighter1_239_311_Open_Image.style.display='inline'; Codehighlighter1_239_311_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>   </span><span id=Codehighlighter1_239_311_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_239_311_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>       </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">cout<<subtree<<endl;</span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">       sum</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>       </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">;        <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>   }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(subtree.size()</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">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_354_455_Open_Image onclick="this.style.display='none'; Codehighlighter1_354_455_Open_Text.style.display='none'; Codehighlighter1_354_455_Closed_Image.style.display='inline'; Codehighlighter1_354_455_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_354_455_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_354_455_Closed_Text.style.display='none'; Codehighlighter1_354_455_Open_Image.style.display='inline'; Codehighlighter1_354_455_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>   </span><span id=Codehighlighter1_354_455_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_354_455_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   </span><span style="COLOR: #0000ff">for</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">m;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>      </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(subtree[subtree.size()</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">num[i])<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>             </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>   }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>   </span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(;i</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">m;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_477_529_Open_Image onclick="this.style.display='none'; Codehighlighter1_477_529_Open_Text.style.display='none'; Codehighlighter1_477_529_Closed_Image.style.display='inline'; Codehighlighter1_477_529_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_477_529_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_477_529_Closed_Text.style.display='none'; Codehighlighter1_477_529_Open_Image.style.display='inline'; Codehighlighter1_477_529_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>   </span><span id=Codehighlighter1_477_529_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_477_529_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>      dfs(subtree</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">num[i],level</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);            <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>   }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>         <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">argv[])<br><img id=Codehighlighter1_577_977_Open_Image onclick="this.style.display='none'; Codehighlighter1_577_977_Open_Text.style.display='none'; Codehighlighter1_577_977_Closed_Image.style.display='inline'; Codehighlighter1_577_977_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_577_977_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_577_977_Closed_Text.style.display='none'; Codehighlighter1_577_977_Open_Image.style.display='inline'; Codehighlighter1_577_977_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_577_977_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_577_977_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(scanf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d%d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">m,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">n)</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">EOF)<br><img id=Codehighlighter1_619_928_Open_Image onclick="this.style.display='none'; Codehighlighter1_619_928_Open_Text.style.display='none'; Codehighlighter1_619_928_Closed_Image.style.display='inline'; Codehighlighter1_619_928_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_619_928_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_619_928_Closed_Text.style.display='none'; Codehighlighter1_619_928_Open_Image.style.display='inline'; Codehighlighter1_619_928_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_619_928_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_619_928_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(m</span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000">20</span><span style="COLOR: #000000">)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>           </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(n</span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000">m) <br><img id=Codehighlighter1_671_911_Open_Image onclick="this.style.display='none'; Codehighlighter1_671_911_Open_Text.style.display='none'; Codehighlighter1_671_911_Closed_Image.style.display='inline'; Codehighlighter1_671_911_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_671_911_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_671_911_Closed_Text.style.display='none'; Codehighlighter1_671_911_Open_Image.style.display='inline'; Codehighlighter1_671_911_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>           </span><span id=Codehighlighter1_671_911_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_671_911_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              sum</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              num</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">[m];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                </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">m;</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">i)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                  num[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                dfs(</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">,</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">);   <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">sum</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">endl;      <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                delete num;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                    }</span></span><span style="COLOR: #000000">           <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>         <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">system("PAUSE");</span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></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><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <img src ="http://www.shnenglu.com/cjz/aggbug/41936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cjz/" target="_blank">椋涘ぉ</a> 2008-01-26 14:39 <a href="http://www.shnenglu.com/cjz/archive/2008/01/26/41936.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ACM 1005] 鍋氬夠鏂?/title><link>http://www.shnenglu.com/cjz/archive/2008/01/20/41517.html</link><dc:creator>椋涘ぉ</dc:creator><author>椋涘ぉ</author><pubDate>Sun, 20 Jan 2008 06:31:00 GMT</pubDate><guid>http://www.shnenglu.com/cjz/archive/2008/01/20/41517.html</guid><wfw:comment>http://www.shnenglu.com/cjz/comments/41517.html</wfw:comment><comments>http://www.shnenglu.com/cjz/archive/2008/01/20/41517.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/cjz/comments/commentRss/41517.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/cjz/services/trackbacks/41517.html</trackback:ping><description><![CDATA[<p align=center><font color=blue size=5>鍋氬夠鏂?/font> <br>Time Limit:1000MS  Memory Limit:1024K<br></p> <div align=left> <h3>Description:</h3> Apple鏈榪戣糠涓婁簡(jiǎn)鍋氬夠鏂癸紝Apple榪樻槸涓腑楂樻墜錛屽彧瑕佷綘璇翠釜濂囨暟N灝辮兘鎶奛*N鐨勫夠鏂瑰仛鍑烘潵銆傚叾瀹炰綘鍙互姣斾粬鍋氬緱鏇村ソ鐨勩侫pple鎬繪槸鐢誨緱寰堜貢錛岃屼綘鍙互鍒╃敤紼嬪簭鎺掑緱寰堟暣榻恀_^ 騫繪柟鐨勮姹傦細(xì)姣忎竴琛岋紝姣忎竴鍒楋紝榪樻湁涓ゆ潯鏂滅嚎涓婃暟瀛楃殑鍜岄兘鐩哥瓑 <p> <h3>Input:</h3> 姣忚涓涓暟N(0< N < 30),杈撳叆0緇撴潫 <h3>Output:</h3> 杈撳叆涓涓鏁幫紝杈撳嚭涓涓夠鏂癸紝姣忎釜鏁板崰3鏍鹼紝欏哄簭鍙傜収鏍鋒澘杈撳嚭,杈撳嚭瀹屼互鍚庡姞涓涓洖杞︺? <h3>Sample Input:</h3> <pre>5 1 0 </pre> <h3>Sample Output:</h3> <pre> 11 18 25 2 9 10 12 19 21 3 4 6 13 20 22 23 5 7 14 16 17 24 1 8 15 1</pre> <h3>Hint:</h3> 濡傛灉涓嶄細(xì)鍋氬夠鏂圭殑璇蜂粠1寮濮嬫暟鍒版渶鍚庯紝鐩鎬俊浣犱細(xì)鍙戠幇鍏朵腑鐨勮寰嬨傚綋鐒惰緭鍑轟篃瑕佹寜鐓ц繖鏍風(fēng)殑鏍煎紡 <h3>Source:</h3> Zhang Anping </div> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><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><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> std;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000"> MAX 30</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> data[</span><span style="COLOR: #000000">30</span><span style="COLOR: #000000">][</span><span style="COLOR: #000000">30</span><span style="COLOR: #000000">];<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> solve(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n)<br><img id=Codehighlighter1_103_575_Open_Image onclick="this.style.display='none'; Codehighlighter1_103_575_Open_Text.style.display='none'; Codehighlighter1_103_575_Closed_Image.style.display='inline'; Codehighlighter1_103_575_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_103_575_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_103_575_Closed_Text.style.display='none'; Codehighlighter1_103_575_Open_Image.style.display='inline'; Codehighlighter1_103_575_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_103_575_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_103_575_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> i;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> _x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,_y</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> index</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">n</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">,y</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">n</span><span style="COLOR: #000000">/</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  </span><span style="COLOR: #0000ff">for</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><img id=Codehighlighter1_195_244_Open_Image onclick="this.style.display='none'; Codehighlighter1_195_244_Open_Text.style.display='none'; Codehighlighter1_195_244_Closed_Image.style.display='inline'; Codehighlighter1_195_244_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_195_244_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_195_244_Closed_Text.style.display='none'; Codehighlighter1_195_244_Open_Image.style.display='inline'; Codehighlighter1_195_244_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </span><span id=Codehighlighter1_195_244_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_195_244_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>      </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><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>          data[i][j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>     <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(index</span><span style="COLOR: #000000"><=</span><span style="COLOR: #000000">n</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">n)<br><img id=Codehighlighter1_269_457_Open_Image onclick="this.style.display='none'; Codehighlighter1_269_457_Open_Text.style.display='none'; Codehighlighter1_269_457_Closed_Image.style.display='inline'; Codehighlighter1_269_457_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_269_457_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_269_457_Closed_Text.style.display='none'; Codehighlighter1_269_457_Open_Image.style.display='inline'; Codehighlighter1_269_457_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </span><span id=Codehighlighter1_269_457_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_269_457_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        data[x][y]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">index;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> newx</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">x</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">_x;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> newy</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">y</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">_y;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(newx</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">n) newx</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(newy</span><span style="COLOR: #000000">>=</span><span style="COLOR: #000000">n) newy</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(data[newx][newy]</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_397_409_Open_Image onclick="this.style.display='none'; Codehighlighter1_397_409_Open_Text.style.display='none'; Codehighlighter1_397_409_Closed_Image.style.display='inline'; Codehighlighter1_397_409_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_397_409_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_397_409_Closed_Text.style.display='none'; Codehighlighter1_397_409_Open_Image.style.display='inline'; Codehighlighter1_397_409_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span id=Codehighlighter1_397_409_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_397_409_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            x</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br><img id=Codehighlighter1_420_442_Open_Image onclick="this.style.display='none'; Codehighlighter1_420_442_Open_Text.style.display='none'; Codehighlighter1_420_442_Closed_Image.style.display='inline'; Codehighlighter1_420_442_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_420_442_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_420_442_Closed_Text.style.display='none'; Codehighlighter1_420_442_Open_Image.style.display='inline'; Codehighlighter1_420_442_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span id=Codehighlighter1_420_442_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_420_442_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            x</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">newx;y</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">newy;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        index</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top> <br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  </span><span style="COLOR: #0000ff">for</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><img id=Codehighlighter1_486_559_Open_Image onclick="this.style.display='none'; Codehighlighter1_486_559_Open_Text.style.display='none'; Codehighlighter1_486_559_Closed_Image.style.display='inline'; Codehighlighter1_486_559_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_486_559_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_486_559_Closed_Text.style.display='none'; Codehighlighter1_486_559_Open_Image.style.display='inline'; Codehighlighter1_486_559_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>  </span><span id=Codehighlighter1_486_559_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_486_559_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>      </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><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>          printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%3d</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,data[i][j]);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>      cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">endl;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>  }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>  cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">endl;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000"> argv[])<br><img id=Codehighlighter1_611_740_Open_Image onclick="this.style.display='none'; Codehighlighter1_611_740_Open_Text.style.display='none'; Codehighlighter1_611_740_Closed_Image.style.display='inline'; Codehighlighter1_611_740_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_611_740_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_611_740_Closed_Text.style.display='none'; Codehighlighter1_611_740_Open_Image.style.display='inline'; Codehighlighter1_611_740_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_611_740_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_611_740_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> input;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">input</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">input</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_655_726_Open_Image onclick="this.style.display='none'; Codehighlighter1_655_726_Open_Text.style.display='none'; Codehighlighter1_655_726_Closed_Image.style.display='inline'; Codehighlighter1_655_726_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_655_726_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_655_726_Closed_Text.style.display='none'; Codehighlighter1_655_726_Open_Image.style.display='inline'; Codehighlighter1_655_726_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_655_726_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_655_726_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(input</span><span style="COLOR: #000000">%</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) </span><span style="COLOR: #0000ff">continue</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(input</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">&&</span><span style="COLOR: #000000">input</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">30</span><span style="COLOR: #000000">)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>            solve(input);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div> <img src ="http://www.shnenglu.com/cjz/aggbug/41517.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/cjz/" target="_blank">椋涘ぉ</a> 2008-01-20 14:31 <a href="http://www.shnenglu.com/cjz/archive/2008/01/20/41517.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>[ACM 1002] 鏁板瓧娓告垙http://www.shnenglu.com/cjz/archive/2008/01/20/41514.html椋涘ぉ椋涘ぉSun, 20 Jan 2008 05:30:00 GMThttp://www.shnenglu.com/cjz/archive/2008/01/20/41514.htmlhttp://www.shnenglu.com/cjz/comments/41514.htmlhttp://www.shnenglu.com/cjz/archive/2008/01/20/41514.html#Feedback0http://www.shnenglu.com/cjz/comments/commentRss/41514.htmlhttp://www.shnenglu.com/cjz/services/trackbacks/41514.html鏁板瓧娓告垙
Time Limit:1000MS  Memory Limit:1024K

Description:

鏈榪慍atcher瀵規(guī)暟瀛楁父鎴忓緢鎰熷叴瓚o紝浠栧彂鏄庝簡(jiǎn)涓縐嶆柊鐨勬父鎴忥紝緇欏嚭涓涓暟N錛岄棶N鏄惁鑳借〃紺烘垚鏌愪釜姝f暣鏁癤鐨凨嬈″箓錛圞錛?錛夛紝N鍙兘鏈夊縐嶈〃紺烘柟娉曪紝璇鋒壘鍑烘渶澶х殑X騫惰緭鍑虹浉搴旂殑K銆備緥濡?16錛?^4錛?^2,64錛?^3錛?^6=8^2鍒?6搴旇〃紺轟負(fù)4錛?錛?4搴旇〃紺轟負(fù)8錛?銆?

Input:

姣忚涓涓鏁存暟N錛岃緭鍏ユ枃浠朵互0涓虹粨鏉熸爣蹇椼傦紙0錛淣錛?0^8錛?

Output:

姣忚鏈変袱涓暣鏁幫紝濡傛灉鑳借〃紺猴紝鍒欒緭鍑篨銆K錛岋紙涓棿鐢ㄤ竴涓┖鏍奸殧寮錛夊鏋滀笉鑳斤紝鍒欒緭鍑?銆0錛?

Sample Input:

5
4
16
27
0

Sample Output:

0 0
2 2
4 2
3 3

Source:

Jin Qiwei
/*
**    Author    :flysky
**  date    :2008-01-20    
**    Description: 
http://acm.zjut.edu.cn/ShowProblem.aspx?ShowID=1002
*/

#include 
<iostream>
#include 
<math.h>
using namespace std;

#define MAX 50

void solve(int number)
{
    
int k=sqrt(number);
    
for(int i=k;i>1;--i)
    
{
        
int j=2;
        
bool loop=true;
        
while(loop)
        
{
            
if(pow(i,j)==number)
            
{
                cout
<<i<<" "<<j<<endl;
                
return;
            }

            
else if(pow(i,j)>number)
                loop
=false;
            
else
                j
++;
        }

    }

    cout
<<0<<" "<<0<<endl;
}


int main()
{
    
int input[MAX];
    
int len=0;
    
while((cin>>input[len])&&input[len]!=0)
    
{
        
if(input[len]<0||input[len]>pow(10,8))
            
continue;
        len
++;
    }

    
for(int i=0;i<len;++i)
        solve(input[i]);
    
return 0;
}


椋涘ぉ 2008-01-20 13:30 鍙戣〃璇勮
]]>
[ACM 1001] 瀵嗙爜鎴幏http://www.shnenglu.com/cjz/archive/2008/01/19/41461.html椋涘ぉ椋涘ぉSat, 19 Jan 2008 06:36:00 GMThttp://www.shnenglu.com/cjz/archive/2008/01/19/41461.htmlhttp://www.shnenglu.com/cjz/comments/41461.htmlhttp://www.shnenglu.com/cjz/archive/2008/01/19/41461.html#Feedback0http://www.shnenglu.com/cjz/comments/commentRss/41461.htmlhttp://www.shnenglu.com/cjz/services/trackbacks/41461.html

瀵嗙爜鎴幏
Time Limit:1000MS  Memory Limit:1024K

Description:

Catcher鏄疢CA鍥界殑鎯呮姤鍛橈紝浠栧伐浣滄椂鍙戠幇鏁屽浗浼?xì)鐢ㄤ竴浜涘縐扮殑瀵嗙爜榪涜閫氫俊錛屾瘮濡傚儚榪欎簺ABBA錛孉BA錛孉錛?23321錛屼絾鏄粬浠湁鏃朵細(xì)鍦ㄥ紑濮嬫垨緇撴潫鏃跺姞鍏ヤ竴浜涙棤鍏崇殑瀛楃浠ラ槻姝㈠埆鍥界牬瑙c傛瘮濡傝繘琛屼笅鍒楀彉鍖朅BBA->12ABBA,ABA->ABAKK,123321->51233214銆銆傚洜涓烘埅鑾風(fēng)殑涓插お闀夸簡(jiǎn)錛岃屼笖瀛樺湪澶氱鍙兘鐨勬儏鍐碉紙abaaab鍙湅浣滄槸aba,鎴朾aaab鐨勫姞瀵嗗艦寮忥級(jí)錛孋athcer鐨勫伐浣滈噺瀹炲湪鏄お澶т簡(jiǎn)錛屼粬鍙兘鍚戠數(shù)鑴戦珮鎵嬫眰鍔╋紝浣犺兘甯瓹atcher鎵懼嚭鏈闀跨殑鏈夋晥瀵嗙爜涓插悧錛?

Input:

嫻嬭瘯鏁版嵁鏈夎嫢騫茶瀛楃涓詫紝鍖呮嫭瀛楁瘝錛屾暟瀛楋紝絎﹀彿銆傦紙瀛楁瘝鍖哄垎澶у皬鍐欙級(jí)

Output:

涓庤緭鍏ョ浉瀵瑰簲姣忎竴琛岃緭鍑轟竴涓暣鏁幫紝浠h〃鏈闀挎湁鏁堝瘑鐮佷覆鐨勯暱搴︺?

Sample Input:

ABBA
12ABBA
A
ABAKK
51233214
abaaab

Sample Output:

4
4
1
3
6
5
/*
** °ÝÃD´y­z:http://acm.zjut.edu.cn/ShowProblem.aspx?ShowID=1001
** Author: flysky
** date:   2008-01-19 ª¯§¾¤u§@°V½m¤é
*/

#include 
<iostream>
#include 
<string>

using namespace std;


int solve(string &input)
{
  
   
int len=input.size();
   
int passlen=1;
   
for(int i=0;i<len;i++)
   
{
      
int k=i;
      
int p2=0;
      bool same
=false;
      
for(int j=len-1;j>i;j--)
      
{
              
if(input[k]==input[j])
              
{
                  
if(!same)
                     p2
=j;
                  k
++;
                  same
=true;
              }

              
else
              
{
                  same
=false;
                  k
=i;
              }

                  
      }

      
if(passlen<p2-i+1) passlen=p2-i+1;
   }

   
return passlen;     
}

int main(int argc, char *argv[])
{
    string input;
    
while(1)
    
{
        cin
>>input;
    
    
        cout
<<solve(input)<<endl;
    }

        

    
return 0;
}



鑷繁娓│娌掑晱欏岋紝鎻愪氦鍗諱笉閫氶亷錛屾劅瑕洪鐩矑鏈夎娓呮濡備綍閫鍑恒?br>----------------------------------------------------------------------------------------------
nana di~緄傛柤璁撴垜閬庝簡(jiǎn)
姝g⒑浠g⒓錛?br>
#include <iostream>
#include 
<string>

using namespace std;


int solve(char *input,int len)
{
  
   
int passlen=1;
   
for(int i=0;i<len;i++)
   
{
      
int k=i;
      
int p2=0;
      bool same
=false;
      
for(int j=len-1;j>i;j--)
      
{
              
if(input[k]==input[j])
              
{
                  same
=true;
                  p2
=j;
                  
for(int j1=j-1,i1=k+1;j1>i1;j1--,i1++)
                     
if(input[i1]!=input[j1])
                     
{
                         same
=false;
                         
break;
                     }

              }

              
else
              
{
                  same
=false;
                  k
=i;
              }

              
if(same)
              
{
                 
if(passlen<p2-i+1) passlen=p2-i+1;
                 
//i=p2+1;
                 break;
              }

                  
      }

      
   }

   
return passlen;     
}

int main(int argc, char *argv[])
{
    
char input[100];
    
while(scanf("%s",input)!=EOF)
    
{
        cout
<<solve(input,strlen(input))<<endl;
    }

        

    
return 0;
}



椋涘ぉ 2008-01-19 14:36 鍙戣〃璇勮
]]>
久久91精品久久91综合| 久久久久亚洲av无码专区导航| 少妇被又大又粗又爽毛片久久黑人| 精品久久久久久国产三级| 久久笫一福利免费导航 | 日韩亚洲欧美久久久www综合网| 国产福利电影一区二区三区久久久久成人精品综合 | 久久青青草原精品影院| 色偷偷88欧美精品久久久| 久久天堂AV综合合色蜜桃网| 久久99久久无码毛片一区二区| 精品一二三区久久aaa片| 久久精品亚洲乱码伦伦中文| 国产精品女同久久久久电影院| 香蕉久久影院| 国产精品成人精品久久久| 亚洲国产精品18久久久久久| 久久久精品国产亚洲成人满18免费网站| 人人狠狠综合久久88成人| 亚洲精品NV久久久久久久久久 | 久久久久久久女国产乱让韩| 久久99精品国产麻豆蜜芽| 成人妇女免费播放久久久| 久久久久久伊人高潮影院| 久久伊人五月天论坛| 91精品国产综合久久香蕉| 九九久久自然熟的香蕉图片| 精品国产日韩久久亚洲| 久久久久99精品成人片三人毛片 | 久久久久久久女国产乱让韩| 国产日韩欧美久久| 狠狠色丁香婷综合久久| 久久久久久久97| 亚洲va久久久噜噜噜久久天堂| 亚洲国产精品无码久久久久久曰| 精品多毛少妇人妻AV免费久久| 久久精品国产69国产精品亚洲| 好属妞这里只有精品久久| 精品久久久久香蕉网| 97精品伊人久久大香线蕉app | 色狠狠久久综合网|