锘??xml version="1.0" encoding="utf-8" standalone="yes"?>四虎国产精品免费久久5151,日韩人妻无码精品久久免费一 ,久久久这里只有精品加勒比http://www.shnenglu.com/ruphy/category/13775.html鑴辯浜?jiǎn)瀵傚癁锛岃蛋杩涗簡(jiǎn)瀛ょ嫭锛尲浾d紑浜?jiǎn)娆箰锛屾鍏ヤ簡(jiǎn)鐤?..zh-cnTue, 11 May 2010 19:50:15 GMTTue, 11 May 2010 19:50:15 GMT60鍝堝伐紼?003錛圚ay Points錛?/title><link>http://www.shnenglu.com/ruphy/articles/115005.html</link><dc:creator>姊︾窘鑻嶇┕</dc:creator><author>姊︾窘鑻嶇┕</author><pubDate>Mon, 10 May 2010 08:28:00 GMT</pubDate><guid>http://www.shnenglu.com/ruphy/articles/115005.html</guid><wfw:comment>http://www.shnenglu.com/ruphy/comments/115005.html</wfw:comment><comments>http://www.shnenglu.com/ruphy/articles/115005.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ruphy/comments/commentRss/115005.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ruphy/services/trackbacks/115005.html</trackback:ping><description><![CDATA[<p><span>TimeLimit: </span>1 Second   <span>MemoryLimit: </span>32 Megabyte </p> <p><span>Totalsubmit: </span>676   <span>Accepted: </span>426   </p> <div id="oshxttk" class="content editor_content"> <p class=title>Description</p> <p>Each employee of a bureaucracy has a job description - a few paragraphs that describe the responsibilities of the job. The employee's job description, combined with other factors, such as seniority, is used to determine his or her salary.</p> <p>The Hay Point system frees the Human Resources department from having to make an intelligent judgement as to the value of the employee; the job description is merely scanned for words and phrases that indicate responsibility. In particular, job descriptions that indicate control over a large budget or management over a large number of people yield high Hay Point scores.</p> <p>You are to implement a simplified Hay Point system. You will be given a Hay Point dictionary and a number of job descriptions. For each job description you are to compute the salary associated with the job, according to the system. </p> <p class=title>Input</p> <p>The first line of input contains 2 positive integers: m <= 1000, the number of words in the Hay Point dictionary, and n <= 100, the number of job descriptions. m lines follow; each contains a word (a string of up to 16 lower-case letters) and a dollar value (a real number between 0 and 1,000,000). Following the dictionary are the n job descriptions. Each job description consists of one or more lines of text; for your convenience the text has been converted to lower case and has no characters other than letters, numbers, and spaces. Each job description is terminated by a line containing a period. </p> <p class=title>Output</p> <p>For each job description, output the corresponding salary computed as the sum of the Hay Point values for all words that appear in the description. Words that do not appear in the dictionary have a value of 0. </p> <p class=title>Sample Input</p> <p class=width>7 2<br>administer 100000<br>spending 200000<br>manage 50000<br>responsibility 25000<br>expertise 100<br>skill 50<br>money 75000<br>the incumbent will administer the spending of kindergarden milk money<br>and exercise responsibility for making change he or she will share<br>responsibility for the task of managing the money with the assistant<br>whose skill and expertise shall ensure the successful spending exercise<br>.<br>this individual must have the skill to perform a heart transplant and<br>expertise in rocket science<br>.</p> <p class=title>Sample Output</p> <p class=width>700150<br>150<br>榪欓寰堟按鐨勶紝鐩存帴瀹氫箟涓string綾繪暟緇勶紝鐒跺悗鍐嶄粠鏂囨鏌ユ壘璁板綍灝辮錛岀洿鎺ョ湅浠g爜<br></p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><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></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img id=Codehighlighter1_63_86_Open_Image onclick="this.style.display='none'; Codehighlighter1_63_86_Open_Text.style.display='none'; Codehighlighter1_63_86_Closed_Image.style.display='inline'; Codehighlighter1_63_86_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_63_86_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_63_86_Closed_Text.style.display='none'; Codehighlighter1_63_86_Open_Image.style.display='inline'; Codehighlighter1_63_86_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">struct</span><span id=Codehighlighter1_63_86_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_63_86_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> s;<br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> money;<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">dictionary[</span><span style="COLOR: #000000">1000</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> description[</span><span style="COLOR: #000000">10000</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img id=Codehighlighter1_143_1229_Open_Image onclick="this.style.display='none'; Codehighlighter1_143_1229_Open_Text.style.display='none'; Codehighlighter1_143_1229_Closed_Image.style.display='inline'; Codehighlighter1_143_1229_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_143_1229_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_143_1229_Closed_Text.style.display='none'; Codehighlighter1_143_1229_Open_Image.style.display='inline'; Codehighlighter1_143_1229_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_143_1229_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_143_1229_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">freopen("in.txt","r",stdin);<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">freopen("out.txt","w",stdout);</span><span style="COLOR: #008000"><br></span><span style="COLOR: #008080">13</span><span style="COLOR: #008000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> m,n,temp,sum;<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><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">m</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">n)<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img id=Codehighlighter1_264_1190_Open_Image onclick="this.style.display='none'; Codehighlighter1_264_1190_Open_Text.style.display='none'; Codehighlighter1_264_1190_Closed_Image.style.display='inline'; Codehighlighter1_264_1190_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_264_1190_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_264_1190_Closed_Text.style.display='none'; Codehighlighter1_264_1190_Open_Image.style.display='inline'; Codehighlighter1_264_1190_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_264_1190_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_264_1190_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><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;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                    cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">dictionary[i].s</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">dictionary[i].money;<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><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">n;i</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_431_1184_Open_Image onclick="this.style.display='none'; Codehighlighter1_431_1184_Open_Text.style.display='none'; Codehighlighter1_431_1184_Closed_Image.style.display='inline'; Codehighlighter1_431_1184_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_431_1184_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_431_1184_Closed_Text.style.display='none'; Codehighlighter1_431_1184_Open_Image.style.display='inline'; Codehighlighter1_431_1184_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>                    </span><span id=Codehighlighter1_431_1184_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_431_1184_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                            </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> j;<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                            </span><span style="COLOR: #0000ff">for</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">)<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img id=Codehighlighter1_573_778_Open_Image onclick="this.style.display='none'; Codehighlighter1_573_778_Open_Text.style.display='none'; Codehighlighter1_573_778_Closed_Image.style.display='inline'; Codehighlighter1_573_778_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_573_778_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_573_778_Closed_Text.style.display='none'; Codehighlighter1_573_778_Open_Image.style.display='inline'; Codehighlighter1_573_778_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>                            </span><span id=Codehighlighter1_573_778_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_573_778_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                         cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">description[j];<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                         </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(description[j]</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">.</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                         </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                            }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                            temp</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">j;<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><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;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img id=Codehighlighter1_893_1117_Open_Image onclick="this.style.display='none'; Codehighlighter1_893_1117_Open_Text.style.display='none'; Codehighlighter1_893_1117_Closed_Image.style.display='inline'; Codehighlighter1_893_1117_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_893_1117_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_893_1117_Closed_Text.style.display='none'; Codehighlighter1_893_1117_Open_Image.style.display='inline'; Codehighlighter1_893_1117_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>                            </span><span id=Codehighlighter1_893_1117_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_893_1117_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><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">temp;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(dictionary[i].s</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">description[j])<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                    sum</span><span style="COLOR: #000000">+=</span><span style="COLOR: #000000">dictionary[i].money;<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                            }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">39</span><span style="COLOR: #008000"><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></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000">        <br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <p class=width><br><br> </p> </div> <img src ="http://www.shnenglu.com/ruphy/aggbug/115005.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ruphy/" target="_blank">姊︾窘鑻嶇┕</a> 2010-05-10 16:28 <a href="http://www.shnenglu.com/ruphy/articles/115005.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍝堝伐紼?001錛團(tuán)orests錛?/title><link>http://www.shnenglu.com/ruphy/articles/115002.html</link><dc:creator>姊︾窘鑻嶇┕</dc:creator><author>姊︾窘鑻嶇┕</author><pubDate>Mon, 10 May 2010 07:59:00 GMT</pubDate><guid>http://www.shnenglu.com/ruphy/articles/115002.html</guid><wfw:comment>http://www.shnenglu.com/ruphy/comments/115002.html</wfw:comment><comments>http://www.shnenglu.com/ruphy/articles/115002.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ruphy/comments/commentRss/115002.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ruphy/services/trackbacks/115002.html</trackback:ping><description><![CDATA[<p><span>TimeLimit: </span>1 Second   <span>MemoryLimit: </span>32 Megabyte </p> <p><span>Totalsubmit: </span>1413   <span>Accepted: </span>326   </p> <div id="gybmbrp" class="content editor_content"> <p class=title>Description</p> <p>If a tree falls in the forest, and there's nobody there to hear, does it make a sound? This classic conundrum was coined by George Berkeley (1685-1753), the Bishop and influential Irish philosopher whose primary philosophical achievement is the advancement of what has come to be called subjective idealism. He wrote a number of works, of which the most widely-read are Treatise Concerning the Principles of Human Knowledge (1710) and Three Dialogues between Hylas and Philonous (1713) (Philonous, the "lover of the mind," representing Berkeley himself).</p> <p class=title>Input</p> <p>A forest contains T trees numbered from 1 to T and P people numbered from 1 to P. Standard input consists of a line containing P and T followed by several lines, containing a pair of integers i and j, indicating that person i has heard tree j fall. People may have different opinions as to which trees, according to Berkeley, have made a sound. </p> <p>Input contains multiple test cases. Subsequent test cases are separated with a single blank line.</p> <p class=title>Output</p> <p>How many different opinions are represented in the input? Two people hold the same opinion only if they hear exactly the same set of trees. You may assume that P < 100 and T < 100.</p> <p class=title>Sample Input</p> <p class=width>3 4<br>1 2<br>3 3<br>1 3<br>2 2<br>3 2<br>2 4 </p> <p class=title>Sample Output</p> <p class=width>2</p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><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">stdio.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">stdlib.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img id=Codehighlighter1_48_561_Open_Image onclick="this.style.display='none'; Codehighlighter1_48_561_Open_Text.style.display='none'; Codehighlighter1_48_561_Closed_Image.style.display='inline'; Codehighlighter1_48_561_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_48_561_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_48_561_Closed_Text.style.display='none'; Codehighlighter1_48_561_Open_Image.style.display='inline'; Codehighlighter1_48_561_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_48_561_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_48_561_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> n,m,a,b,i,j,k;<br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> s[</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">][</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">],arr[</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> flag,sum;<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> str[</span><span style="COLOR: #000000">100</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><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">n,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">m)</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">EOF)<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img id=Codehighlighter1_156_558_Open_Image onclick="this.style.display='none'; Codehighlighter1_156_558_Open_Text.style.display='none'; Codehighlighter1_156_558_Closed_Image.style.display='inline'; Codehighlighter1_156_558_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_156_558_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_156_558_Closed_Text.style.display='none'; Codehighlighter1_156_558_Open_Image.style.display='inline'; Codehighlighter1_156_558_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_156_558_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_156_558_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img id=Codehighlighter1_182_222_Open_Image onclick="this.style.display='none'; Codehighlighter1_182_222_Open_Text.style.display='none'; Codehighlighter1_182_222_Closed_Image.style.display='inline'; Codehighlighter1_182_222_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_182_222_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_182_222_Closed_Text.style.display='none'; Codehighlighter1_182_222_Open_Image.style.display='inline'; Codehighlighter1_182_222_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_182_222_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_182_222_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>arr[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">for</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">m;j</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>s[i][j]</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"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>getchar(); <br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000"> (gets(str)</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">NULL) <br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img id=Codehighlighter1_261_358_Open_Image onclick="this.style.display='none'; Codehighlighter1_261_358_Open_Text.style.display='none'; Codehighlighter1_261_358_Closed_Image.style.display='inline'; Codehighlighter1_261_358_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_261_358_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_261_358_Closed_Text.style.display='none'; Codehighlighter1_261_358_Open_Image.style.display='inline'; Codehighlighter1_261_358_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_261_358_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_261_358_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (str[</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">]</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">\0</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">) <br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>           </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>      sscanf(str,</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">a,</span><span style="COLOR: #000000">&</span><span style="COLOR: #000000">b); <br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    s[a</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">][b</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">25</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img id=Codehighlighter1_377_534_Open_Image onclick="this.style.display='none'; Codehighlighter1_377_534_Open_Text.style.display='none'; Codehighlighter1_377_534_Closed_Image.style.display='inline'; Codehighlighter1_377_534_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_377_534_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_377_534_Closed_Text.style.display='none'; Codehighlighter1_377_534_Open_Image.style.display='inline'; Codehighlighter1_377_534_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_377_534_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_377_534_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(arr[i]</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img id=Codehighlighter1_393_532_Open_Image onclick="this.style.display='none'; Codehighlighter1_393_532_Open_Text.style.display='none'; Codehighlighter1_393_532_Closed_Image.style.display='inline'; Codehighlighter1_393_532_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_393_532_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_393_532_Closed_Text.style.display='none'; Codehighlighter1_393_532_Open_Image.style.display='inline'; Codehighlighter1_393_532_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_393_532_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_393_532_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>sum</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(j</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">i</span><span style="COLOR: #000000">+</span><span style="COLOR: #000000">1</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">32</span><span style="COLOR: #000000"><img id=Codehighlighter1_421_530_Open_Image onclick="this.style.display='none'; Codehighlighter1_421_530_Open_Text.style.display='none'; Codehighlighter1_421_530_Closed_Image.style.display='inline'; Codehighlighter1_421_530_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_421_530_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_421_530_Closed_Text.style.display='none'; Codehighlighter1_421_530_Open_Image.style.display='inline'; Codehighlighter1_421_530_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_421_530_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_421_530_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>flag</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(arr[j]</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img id=Codehighlighter1_445_528_Open_Image onclick="this.style.display='none'; Codehighlighter1_445_528_Open_Text.style.display='none'; Codehighlighter1_445_528_Closed_Image.style.display='inline'; Codehighlighter1_445_528_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_445_528_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_445_528_Closed_Text.style.display='none'; Codehighlighter1_445_528_Open_Image.style.display='inline'; Codehighlighter1_445_528_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_445_528_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_445_528_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">for</span><span style="COLOR: #000000">(k</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;k</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">m;k</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(s[i][k]</span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000">s[j][k])<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img id=Codehighlighter1_485_503_Open_Image onclick="this.style.display='none'; Codehighlighter1_485_503_Open_Text.style.display='none'; Codehighlighter1_485_503_Closed_Image.style.display='inline'; Codehighlighter1_485_503_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_485_503_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_485_503_Closed_Text.style.display='none'; Codehighlighter1_485_503_Open_Image.style.display='inline'; Codehighlighter1_485_503_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span id=Codehighlighter1_485_503_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_485_503_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>flag</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">; <br></span><span style="COLOR: #008080">41</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(flag</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">) <br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>arr[j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">44</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">45</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">46</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">47</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">48</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d\n</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">,sum); <br></span><span style="COLOR: #008080">49</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"> <br></span><span style="COLOR: #008080">50</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span></div> </div> <img src ="http://www.shnenglu.com/ruphy/aggbug/115002.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ruphy/" target="_blank">姊︾窘鑻嶇┕</a> 2010-05-10 15:59 <a href="http://www.shnenglu.com/ruphy/articles/115002.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>榛戦緳姹?010緗戠粶璧涜В棰樻姤鍛婏紙鍝堝伐紼?332 A Football Game錛?/title><link>http://www.shnenglu.com/ruphy/articles/114998.html</link><dc:creator>姊︾窘鑻嶇┕</dc:creator><author>姊︾窘鑻嶇┕</author><pubDate>Mon, 10 May 2010 07:18:00 GMT</pubDate><guid>http://www.shnenglu.com/ruphy/articles/114998.html</guid><wfw:comment>http://www.shnenglu.com/ruphy/comments/114998.html</wfw:comment><comments>http://www.shnenglu.com/ruphy/articles/114998.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ruphy/comments/commentRss/114998.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ruphy/services/trackbacks/114998.html</trackback:ping><description><![CDATA[<p><strong>TimeLimit</strong> : 1 Second <strong>Memorylimit</strong> : 32 Megabyte </p> <p><strong>Totalsubmit</strong> : 165 <strong>Accepted</strong> : 38</p> <div> <p><span>There is a football game between teamX and teamY, we assume the position of the center of football ground is (0, 0),the position of the teamY's goal is(100,0),the position of the teamX's goal is(-100,0).</span></p> <p><span>Now xiaoA in teamX wants to pass the football to his teammate xiaoB, was xiaoB offside(</span><span>瓚婁綅</span><span>)</span><span>錛?/span></p> <h2><span>Input</span></h2> <p><span>The first line of input contains a positive integer N <= 10, the number of test cases. For each test case there is one line contains 24 number, the first and second number indicate the position of xiaoA, the third and forth number indicate the position of xiaoB, and the remaining numbers indicate the positions of the team members in teamY.</span></p> <h2><span>Output</span></h2> <p><span>If xiaoB is offside output "Oh, My god!", else output "Come on!"</span></p> <h2><span>Sample Input</span></h2> <p><span>1</span></p> <p><span>-99 0 99 0 1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0</span></p> <h2><span>Sample Output</span></h2> <p><span>Oh, My god!</span></p> <h2><span>Hint</span></h2> <p><span>If xiaoA passes the football to xiaoB</span><span>錛?/span><span> and there is no members of teamY in front of xiaoB</span><span>錛?/span><span>then xiaoB is offside.</span></p> <p><span>榪欓寰堟按錛屼絾瑕佹敞鎰忚秺浣嶈鍒欙紝鍦ㄥ郊鏂瑰崐鍦哄茍涓攛iaob鐨剎鍧愭爣澶т簬褰兼柟鎵鏈夌悆鍛樼殑x鍧愭爣灝辯畻瓚婁綅銆傚彧闇瑕佸垽鏂璽eamY鐨勬墍鏈夐槦鍛樼殑鏈澶鍧愭爣涓巘eamX鐨剎iaoB鐨勫潗鏍囩殑鍏崇郴鍗沖彲銆?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><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>#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></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></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br><img id=Codehighlighter1_69_553_Open_Image onclick="this.style.display='none'; Codehighlighter1_69_553_Open_Text.style.display='none'; Codehighlighter1_69_553_Closed_Image.style.display='inline'; Codehighlighter1_69_553_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_69_553_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_69_553_Closed_Text.style.display='none'; Codehighlighter1_69_553_Open_Image.style.display='inline'; Codehighlighter1_69_553_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_69_553_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_69_553_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"> ax,ay,bx,by,otherx,othery,max;</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">鍙橀噺鍙噸澶嶄嬌鐢紝涓嶈繃鎴戣寰楁病蹇呰</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">int</span><span style="COLOR: #000000"> n;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">n;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(n</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)<br><img id=Codehighlighter1_170_514_Open_Image onclick="this.style.display='none'; Codehighlighter1_170_514_Open_Text.style.display='none'; Codehighlighter1_170_514_Closed_Image.style.display='inline'; Codehighlighter1_170_514_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_170_514_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_170_514_Closed_Text.style.display='none'; Codehighlighter1_170_514_Open_Image.style.display='inline'; Codehighlighter1_170_514_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_170_514_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_170_514_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              max</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>              cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">ax</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">ay</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">bx</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">by;<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">10</span><span style="COLOR: #000000">;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)</span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">姹傚彇teamy鏈澶х殑X鍧愭爣</span><span style="COLOR: #008000"><br><img id=Codehighlighter1_293_400_Open_Image onclick="this.style.display='none'; Codehighlighter1_293_400_Open_Text.style.display='none'; Codehighlighter1_293_400_Closed_Image.style.display='inline'; Codehighlighter1_293_400_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_293_400_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_293_400_Closed_Text.style.display='none'; Codehighlighter1_293_400_Open_Image.style.display='inline'; Codehighlighter1_293_400_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top></span><span style="COLOR: #000000">              </span><span id=Codehighlighter1_293_400_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_293_400_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                      cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">otherx</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">othery;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                      </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(max</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">otherx)max</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">otherx;<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">(bx</span><span style="COLOR: #000000">></span><span style="COLOR: #000000">max)cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Oh, My god!</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">endl;<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 src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Come on!</span><span style="COLOR: #000000">"</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>    </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> </span></div> <img src ="http://www.shnenglu.com/ruphy/aggbug/114998.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ruphy/" target="_blank">姊︾窘鑻嶇┕</a> 2010-05-10 15:18 <a href="http://www.shnenglu.com/ruphy/articles/114998.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>榛戦緳姹?010緗戠粶璧涜В棰樻姤鍛婏紙鍝堝伐紼?1333 So Many Skirts錛?/title><link>http://www.shnenglu.com/ruphy/articles/114997.html</link><dc:creator>姊︾窘鑻嶇┕</dc:creator><author>姊︾窘鑻嶇┕</author><pubDate>Mon, 10 May 2010 07:16:00 GMT</pubDate><guid>http://www.shnenglu.com/ruphy/articles/114997.html</guid><wfw:comment>http://www.shnenglu.com/ruphy/comments/114997.html</wfw:comment><comments>http://www.shnenglu.com/ruphy/articles/114997.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/ruphy/comments/commentRss/114997.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/ruphy/services/trackbacks/114997.html</trackback:ping><description><![CDATA[<p><strong>TimeLimit</strong> : 1 Second <strong>Memorylimit</strong> : 32 Megabyte </p> <p><strong>Totalsubmit</strong> : 954 <strong>Accepted</strong> : 214</p> <div> <p>xiaoA is a beautiful girl, and she has so many skirts that she won't wear a skirt a second time before the skirt is washed.Now xiaoA wants to go shopping, <br>how many skirts she can choose to wear.<br>In order to distinguish these skirts,she gives out every skirt with a unique name.</p> <p><strong>Input</strong></p> <p>The first line of input contains a positive integer T (T <= 100), the number of test cases.<br>Each test case contains two integers N and M (1<=N,M<=100) in the first line.<br>N is the number of skirts.M is the number of operations. <br>Then N lines follow.Every line contains a word and the word is not longer than 10.<br>Then M lines follow.Each line contains a character 'D' or 'W' and the name of a skirt. <br>'D' indicates that xiaoA has wore the skirt. 'W' indicates that xiaoA has washed the skirt.</p> <p><strong>Output</strong></p> <p>After the M operations, you need to output that how many skirts can be chosen by xiaoA to wear.</p> <p><strong>Sample Input</strong></p> <p>1<br>5 5<br>SkirtA <br>SkirtB <br>SkirtC <br>SkirtD <br>SkirtE<br>D SkirtA <br>D SkirtB <br>D SkirtC <br>D SkirtD <br>W SkirtA</p> <p><strong>Sample Output</strong></p> <p>2</p> <p>姘撮?shù)竴涓?#8230;…錛屾妸鎵鏈塻kirt name璇誨彇鍒頒竴涓猻tring鏁扮粍涓紝鐒跺悗璇誨彇鐘舵侀噺錛屽悓鏃朵笌skirt name鍖歸厤錛屽啀鐢ㄤ竴涓猙ool琛屾暟緇剆tate 璁板綍skirt鐨勫強(qiáng)鏃剁姸鎬併?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><span style="COLOR: #008080"> 1</span><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></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include</span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">cstdlib</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> name[</span><span style="COLOR: #000000">101</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">  name_s;<br></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000"> state[</span><span style="COLOR: #000000">101</span><span style="COLOR: #000000">];<br></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img id=Codehighlighter1_137_1117_Open_Image onclick="this.style.display='none'; Codehighlighter1_137_1117_Open_Text.style.display='none'; Codehighlighter1_137_1117_Closed_Image.style.display='inline'; Codehighlighter1_137_1117_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_137_1117_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_137_1117_Closed_Text.style.display='none'; Codehighlighter1_137_1117_Open_Image.style.display='inline'; Codehighlighter1_137_1117_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_137_1117_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_137_1117_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> T,n,m,count;<br></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> CH;<br></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">T;<br></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>    </span><span style="COLOR: #0000ff">while</span><span style="COLOR: #000000">(T</span><span style="COLOR: #000000">--</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img id=Codehighlighter1_204_1078_Open_Image onclick="this.style.display='none'; Codehighlighter1_204_1078_Open_Text.style.display='none'; Codehighlighter1_204_1078_Closed_Image.style.display='inline'; Codehighlighter1_204_1078_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_204_1078_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_204_1078_Closed_Text.style.display='none'; Codehighlighter1_204_1078_Open_Image.style.display='inline'; Codehighlighter1_204_1078_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>    </span><span id=Codehighlighter1_204_1078_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_204_1078_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              count</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"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">n</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">m;<br></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><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">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              state[i]</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">19</span><span style="COLOR: #000000"><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">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">name[i];<br></span><span style="COLOR: #008080">21</span><span style="COLOR: #000000"><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;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img id=Codehighlighter1_430_961_Open_Image onclick="this.style.display='none'; Codehighlighter1_430_961_Open_Text.style.display='none'; Codehighlighter1_430_961_Closed_Image.style.display='inline'; Codehighlighter1_430_961_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_430_961_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_430_961_Closed_Text.style.display='none'; Codehighlighter1_430_961_Open_Image.style.display='inline'; Codehighlighter1_430_961_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>              </span><span id=Codehighlighter1_430_961_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_430_961_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">23</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                      cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">CH;<br></span><span style="COLOR: #008080">24</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                      cin</span><span style="COLOR: #000000">>></span><span style="COLOR: #000000">name_s;<br></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">26</span><span style="COLOR: #000000"><img id=Codehighlighter1_563_945_Open_Image onclick="this.style.display='none'; Codehighlighter1_563_945_Open_Text.style.display='none'; Codehighlighter1_563_945_Closed_Image.style.display='inline'; Codehighlighter1_563_945_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_563_945_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_563_945_Closed_Text.style.display='none'; Codehighlighter1_563_945_Open_Image.style.display='inline'; Codehighlighter1_563_945_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>                      </span><span id=Codehighlighter1_563_945_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_563_945_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                              </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(name_s</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">name[j])<br></span><span style="COLOR: #008080">28</span><span style="COLOR: #000000"><img id=Codehighlighter1_645_921_Open_Image onclick="this.style.display='none'; Codehighlighter1_645_921_Open_Text.style.display='none'; Codehighlighter1_645_921_Closed_Image.style.display='inline'; Codehighlighter1_645_921_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_645_921_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_645_921_Closed_Text.style.display='none'; Codehighlighter1_645_921_Open_Image.style.display='inline'; Codehighlighter1_645_921_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>                              </span><span id=Codehighlighter1_645_921_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_645_921_Open_Text><span style="COLOR: #000000">{<br></span><span style="COLOR: #008080">29</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                                 </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(CH</span><span style="COLOR: #000000">==</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">D</span><span style="COLOR: #000000">'</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">30</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                                 state[j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">false</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">31</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                                 </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">32</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                                                 state[j]</span><span style="COLOR: #000000">=</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">33</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                              }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">34</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>                      }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">35</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>              }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">36</span><span style="COLOR: #000000"><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">n;i</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">)<br></span><span style="COLOR: #008080">37</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>                      </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000">(state[i])count</span><span style="COLOR: #000000">++</span><span style="COLOR: #000000">;<br></span><span style="COLOR: #008080">38</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>              cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">count</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">endl;<br></span><span style="COLOR: #008080">39</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>    }</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">40</span><span style="COLOR: #000000"><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></span><span style="COLOR: #008080">41</span><span style="COLOR: #008000"><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></span><span style="COLOR: #008080">42</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br></span><span style="COLOR: #008080">43</span><span style="COLOR: #000000"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> </div> <img src ="http://www.shnenglu.com/ruphy/aggbug/114997.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/ruphy/" target="_blank">姊︾窘鑻嶇┕</a> 2010-05-10 15:16 <a href="http://www.shnenglu.com/ruphy/articles/114997.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>榛戦緳姹?010緗戠粶璧涜В棰樻姤鍛?鍝堝伐紼?336 Losing Mobile Phone)http://www.shnenglu.com/ruphy/articles/114996.html姊︾窘鑻嶇┕姊︾窘鑻嶇┕Mon, 10 May 2010 07:13:00 GMThttp://www.shnenglu.com/ruphy/articles/114996.htmlhttp://www.shnenglu.com/ruphy/comments/114996.htmlhttp://www.shnenglu.com/ruphy/articles/114996.html#Feedback0http://www.shnenglu.com/ruphy/comments/commentRss/114996.htmlhttp://www.shnenglu.com/ruphy/services/trackbacks/114996.html

Losing Mobile Phone
TimeLimit
: 1 Second Memorylimit : 32 Megabyte

Totalsubmit : 1 Accepted : 1

Description

XiaoA has N friends , now he would like to contact his friend N , but unfortunately , he lost his mobile phone, and he can just come up with friend 1 's phone number. Can you tell us whether he can build contact with his friend N.

Input

The first line of input contains a positive integer T <= 100, the number of test cases. For each case , there is an integer N (1<=N<=100) in the first line , means xiaoA has N friends , then follows N lines , in the ith line , there is an integer M first, means xiaoA’s friend i can contact with M xiaoA’s friends , then follows M integers kij , means friend i of xiaoA can contact with xiaoA’s friend kij (1<=i<=N, 1<=j<=M,1<=kij<=N) .

Output

For each test case , print one line "yes" if xiaoA can contact with friend N , or "no" instead.

Sample Input

2

5

1 2

1 3

1 4

1 5

4 1 2 3 4

5

3 2 3 4

3 1 3 4

3 1 2 4

3 1 2 3

4 1 2 3 4

Sample Output

yes

no

鐢ㄩ掑綊鐨勬柟娉曢亶鍘嗘墍鏈塮riends錛屾煡鎵炬槸鍚︿細(xì)鍒拌揪friends N濡傛灉鍒拌揪鍒欐爣璁癟RUE銆?/p>

 1#include<iostream>
 2#include<cstdlib>
 3using namespace std;
 4void search(int n); 
 5int T,N;
 6struct{
 7       int relation[105];
 8       bool sign;
 9       int x;
10       }
frien_d[105];
11int main()
12{
13    //freopen("in.dat","r",stdin);
14    //freopen("out.dat","w",stdout);
15    cin>>T;
16    while(T--)
17    {
18              cin>>N;
19              for(int i=1;i<=N;i++)
20              {
21                      cin>>frien_d[i].x;
22                      for(int j=1;j<=frien_d[i].x;j++)
23                      cin>>frien_d[i].relation[j];
24              }

25              for(int i=1;i<N;i++)
26              frien_d[i].sign=true;
27              frien_d[N].sign=false;
28              search(1);
29              if(frien_d[N].sign)
30              cout<<"yes"<<endl;
31              else
32              cout<<"no"<<endl;
33    }

34    //system("PAUSE");
35    return 0;
36}

37void search(int n)
38{
39      if(frien_d[n].sign==false)return;
40      for(int i=1;i<=frien_d[n].x;i++)
41      {
42              if(frien_d[n].relation[i]==N)
43              {
44                                           frien_d[N].sign=true;
45                                           return;
46                                           break;
47              }

48              else 
49              {
50                   frien_d[n].sign=false;
51                   search(frien_d[n].relation[i]);
52              }

53      }

54}

55


姊︾窘鑻嶇┕ 2010-05-10 15:13 鍙戣〃璇勮
]]>
亚洲综合熟女久久久30p| 国产精品女同久久久久电影院| 伊人久久久AV老熟妇色| 久久婷婷国产麻豆91天堂| 伊人伊成久久人综合网777| 2021精品国产综合久久| 国产成人综合久久精品红| 精品一久久香蕉国产线看播放| 久久亚洲精品国产精品| 亚洲精品第一综合99久久| 精品国产热久久久福利| 国产精品禁18久久久夂久| 亚洲综合精品香蕉久久网| 亚洲国产成人久久一区WWW| 91精品免费久久久久久久久| 久久精品人人做人人爽97| 亚洲色婷婷综合久久| 久久成人精品| 青青草原综合久久| 99久久国产综合精品麻豆| 久久亚洲AV成人无码国产| 欧美亚洲国产精品久久| 久久影视综合亚洲| 国产真实乱对白精彩久久| 亚洲综合精品香蕉久久网97| 国产国产成人精品久久| 精品国产一区二区三区久久久狼 | 国内精品久久久久影院日本| 久久精品国产99久久久古代| 国产精品亚洲综合久久| 中文字幕无码久久人妻| 香蕉aa三级久久毛片| 一级a性色生活片久久无少妇一级婬片免费放| 精品久久久无码21p发布| 亚洲精品久久久www| 色播久久人人爽人人爽人人片aV| 久久91综合国产91久久精品| 国产精品美女久久久m| 久久精品国产99国产电影网 | 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 亚洲另类欧美综合久久图片区|