锘??xml version="1.0" encoding="utf-8" standalone="yes"?>色五月五月丁香亚洲综合网,亚洲码一区二区三区,国产成人久久精品亚洲小说http://www.tkk7.com/Person/category/53292.html鏉ュ璇風偣璇勪笅,浜掔浉浜ゆ祦瀛︿範緇忛獙,澶у浜掔浉甯姪 .zh-cnWed, 01 May 2013 19:54:15 GMTWed, 01 May 2013 19:54:15 GMT60HDU 1506 鏈澶х煩闃甸潰縐棶棰榌DP]http://www.tkk7.com/Person/archive/2013/05/01/398630.html澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?Wed, 01 May 2013 15:19:00 GMThttp://www.tkk7.com/Person/archive/2013/05/01/398630.htmlhttp://www.tkk7.com/Person/comments/398630.htmlhttp://www.tkk7.com/Person/archive/2013/05/01/398630.html#Feedback0http://www.tkk7.com/Person/comments/commentRss/398630.htmlhttp://www.tkk7.com/Person/services/trackbacks/398630.htmlLargest Rectangle in a HistogramTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7038    Accepted Submission(s): 1982


Problem Description
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows the histogram that consists of rectangles with the heights 2, 1, 4, 5, 1, 3, 3, measured in units where 1 is the width of the rectangles:

Usually, histograms are used to represent discrete distributions, e.g., the frequencies of characters in texts. Note that the order of the rectangles, i.e., their heights, is important. Calculate the area of the largest rectangle in a histogram that is aligned at the common base line, too. The figure on the right shows the largest aligned rectangle for the depicted histogram.
 

Input
The input contains several test cases. Each test case describes a histogram and starts with an integer n, denoting the number of rectangles it is composed of. You may assume that 1 <= n <= 100000. Then follow n integers h1, ..., hn, where 0 <= hi <= 1000000000. These numbers denote the heights of the rectangles of the histogram in left-to-right order. The width of each rectangle is 1. A zero follows the input for the last test case.
 

Output
For each test case output on a single line the area of the largest rectangle in the specified histogram. Remember that this rectangle must be aligned at the common base line.
 

Sample Input
7 2 1 4 5 1 3 3 4 1000 1000 1000 1000 0
 

Sample Output
8 4000


PS錛氭湁鏃犳湁鏇村姞蹇熺殑鏂規硶鍛紝鏃墮棿涓婅繕鏄瘮杈冩參











澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢? 2013-05-01 23:19 鍙戣〃璇勮
]]>
dp闂涔嬫暟瀛椾笁瑙掑艦闂錛堣佸笀璁茶渚嬮錛?/title><link>http://www.tkk7.com/Person/archive/2013/04/10/397657.html</link><dc:creator>澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?</dc:creator><author>澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?</author><pubDate>Wed, 10 Apr 2013 11:28:00 GMT</pubDate><guid>http://www.tkk7.com/Person/archive/2013/04/10/397657.html</guid><wfw:comment>http://www.tkk7.com/Person/comments/397657.html</wfw:comment><comments>http://www.tkk7.com/Person/archive/2013/04/10/397657.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Person/comments/commentRss/397657.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Person/services/trackbacks/397657.html</trackback:ping><description><![CDATA[     鎽樿: 鏁板瓧涓夎褰㈤棶棰橈細                7               3 8    ...  <a href='http://www.tkk7.com/Person/archive/2013/04/10/397657.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/Person/aggbug/397657.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Person/" target="_blank">澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?</a> 2013-04-10 19:28 <a href="http://www.tkk7.com/Person/archive/2013/04/10/397657.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>1422閲嶆俯涓栫晫鏉?/title><link>http://www.tkk7.com/Person/archive/2013/03/18/396571.html</link><dc:creator>澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?</dc:creator><author>澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?</author><pubDate>Mon, 18 Mar 2013 01:45:00 GMT</pubDate><guid>http://www.tkk7.com/Person/archive/2013/03/18/396571.html</guid><wfw:comment>http://www.tkk7.com/Person/comments/396571.html</wfw:comment><comments>http://www.tkk7.com/Person/archive/2013/03/18/396571.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/Person/comments/commentRss/396571.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/Person/services/trackbacks/396571.html</trackback:ping><description><![CDATA[<div style="background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); padding-bottom: 0px; text-transform: none; background-color: transparent; text-indent: 0px; padding-left: 14px; padding-right: 14px; font: bold 18px Arial; white-space: normal; background-position: 0% 100%; letter-spacing: normal; height: 38px; color: rgb(124,169,237); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_title" align="left">Problem Description</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); text-align: left; padding-bottom: 0px; text-transform: none; text-indent: 0px; margin: 0px; padding-left: 20px; padding-right: 20px; font: 14px 'Times New Roman'; white-space: normal; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_content">涓栫晫鏉粨鏉熶簡,鎰忓ぇ鍒╀漢榪炴湰甯﹀埄鐨勬敹鍥炰簡娉曞浗浜?騫村墠嬈犱粬浠殑鍊?鎹ц搗浜嗗ぇ鍔涚鏉?鎴愬氨浜?鏄熸剰澶у埄.<br />涓栫晫鏉櫧鐒剁粨鏉熶簡,浣嗘槸榪欑晫涓栫晫鏉粰鎴戜滑榪樻槸鐣欎笅璁稿鍊煎緱鍥炲繂鐨勪笢瑗?姣斿鎴戜滑鍚埌浜嗛粍鍚嶅槾鐨?鍒嗛挓嬋鎯呰В璇?鎴戜滑鎳傚緱浜嗗師鏉ュ彲浠ュ悜鍚屼竴涓漢鍑虹ず3寮犻粍鐗岋紝鎴戜滑榪樼湅鍒頒簡榻愯揪鍐呯殑澶翠笉浠呰兘欏剁悆榪樿兘欏朵漢…………<br />浠嬩簬鏈夎繖涔堝鐨勭簿褰?xhd鍐沖畾閲嶆俯寰峰浗涓栫晫鏉?褰撶劧鍙槸鍘誨悇涓壙鍔炰笘鐣屾澂姣旇禌鐨勫煄甯傝蛋璧扮湅鐪?浣嗘槸榪欓渶瑕佷竴澶ф瘮閽?騫歌繍鐨勬槸xhd瀵逛笘鐣屾澂鐨勭儹鐖變箣鎯呮墦鍔ㄤ簡寰峰浗涓栫晫鏉粍濮斾細,浠栦滑灝嗘彁渚泋hd鍦ㄤ腑鍥芥澀宸炲拰寰峰浗浠繪剰涓栫晫鏉壙鍔炲煄甯傜殑寰榪旀満紲?騫惰鏈嶄簡榪欎簺鍩庡競鍦▁hd鍒拌揪榪欏駭鍩庡競鏃朵負浠栨彁渚涗竴絎旂敓媧昏垂浠ヤ究浠栧湪閭i噷鍙傝鏃剁敤,褰撳弬瑙傚畬鏃跺墿浣欑殑閽變篃灝嗙暀緇檟hd,浣嗗綋鐢熸椿璐逛笉澶熸椂浠栦滑灝嗗己琛岀粨鏉焫hd鐨勮繖嬈″痙鍥戒箣琛?闄や簡榪欎釜,浠栦滑榪樻湁涓涓潯浠?xhd鍙兘鏍規嵁浠栦滑鎵緇欑殑璺嚎鍙傝.姣斿鏈?搴у煄甯俛,b,c,浠栦滑緇欏畾浜哸-b-c-a鐨勮礬綰?閭d箞xhd鍙湁3縐嶅弬瑙傞『搴廰bc,bca,cab.鐢變簬鍚勪釜鍩庡競鎵鎻愪緵鐨勭敓媧昏垂鍜屽湪閭i噷鐨勮姳璐歸兘涓嶅悓,榪欎嬌xhd寰堝ご鐥?榪樺ソ鎴戜滑浜嬪厛鐭ラ亾浜嗚繖絎旂敓媧昏垂鍜岃姳璐?璇烽棶xhd鏈澶氳兘欏哄埄鍙傝鍑犲駭鍩庡競?</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); text-transform: none; text-indent: 0px; margin: 0px; font: medium 'Times New Roman'; white-space: normal; background-position: 0% 0%; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_bottom"> </div><br style="text-transform: none; text-indent: 0px; font: medium 'Times New Roman'; white-space: normal; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); padding-bottom: 0px; text-transform: none; background-color: transparent; text-indent: 0px; padding-left: 14px; padding-right: 14px; font: bold 18px Arial; white-space: normal; background-position: 0% 100%; letter-spacing: normal; height: 38px; color: rgb(124,169,237); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_title" align="left">Input</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); text-align: left; padding-bottom: 0px; text-transform: none; text-indent: 0px; margin: 0px; padding-left: 20px; padding-right: 20px; font: 14px 'Times New Roman'; white-space: normal; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_content">姣忕粍杈撳叆鏁版嵁鍒嗕袱琛?絎竴琛屾槸涓涓鏁存暟n(1<=n<=100000),琛ㄧず鏈塶搴у煄甯?鎺ヤ笅鏉ョ殑涓琛屾寜鐓х粰瀹氱殑璺嚎欏哄簭鐨勮緭鍑鴻繖n涓煄甯傜殑鐢熸椿璐瑰拰鑺辮垂,w1,l1,w2,l2,……,wn,ln,鍏朵腑wi,li鍒嗗埆琛ㄧず絎琲涓煄甯傜殑鐢熸椿璐瑰拰鑺辮垂,騫朵笖瀹冧滑閮芥槸姝f暣鏁?</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); text-transform: none; text-indent: 0px; margin: 0px; font: medium 'Times New Roman'; white-space: normal; background-position: 0% 0%; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_bottom"> </div><br style="text-transform: none; text-indent: 0px; font: medium 'Times New Roman'; white-space: normal; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); padding-bottom: 0px; text-transform: none; background-color: transparent; text-indent: 0px; padding-left: 14px; padding-right: 14px; font: bold 18px Arial; white-space: normal; background-position: 0% 100%; letter-spacing: normal; height: 38px; color: rgb(124,169,237); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_title" align="left">Output</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); text-align: left; padding-bottom: 0px; text-transform: none; text-indent: 0px; margin: 0px; padding-left: 20px; padding-right: 20px; font: 14px 'Times New Roman'; white-space: normal; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_content">瀵瑰簲姣忕粍鏁版嵁杈撳嚭鏈澶氳兘鍙傝鐨勫煄甯傛暟.</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); text-transform: none; text-indent: 0px; margin: 0px; font: medium 'Times New Roman'; white-space: normal; background-position: 0% 0%; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_bottom"> </div><br style="text-transform: none; text-indent: 0px; font: medium 'Times New Roman'; white-space: normal; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); padding-bottom: 0px; text-transform: none; background-color: transparent; text-indent: 0px; padding-left: 14px; padding-right: 14px; font: bold 18px Arial; white-space: normal; background-position: 0% 100%; letter-spacing: normal; height: 38px; color: rgb(124,169,237); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_title" align="left">Sample Input</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); text-align: left; padding-bottom: 0px; text-transform: none; text-indent: 0px; margin: 0px; padding-left: 20px; padding-right: 20px; font: 14px 'Times New Roman'; white-space: normal; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_content"><pre style="margin: 0px; font-size: 14px"><div style="font-family: 'Courier New', Courier, monospace">3 3 2 3 4 2 2 3 3 2 3 4 2 3</div></pre></div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-bottom.png); text-transform: none; text-indent: 0px; margin: 0px; font: medium 'Times New Roman'; white-space: normal; background-position: 0% 0%; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_bottom"> </div><br style="text-transform: none; text-indent: 0px; font: medium 'Times New Roman'; white-space: normal; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" /> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-title.png); padding-bottom: 0px; text-transform: none; background-color: transparent; text-indent: 0px; padding-left: 14px; padding-right: 14px; font: bold 18px Arial; white-space: normal; background-position: 0% 100%; letter-spacing: normal; height: 38px; color: rgb(124,169,237); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_title" align="left">Sample Output</div> <div style="background-image: url(http://acm.hdu.edu.cn/images/panel-content.png); text-align: left; padding-bottom: 0px; text-transform: none; text-indent: 0px; margin: 0px; padding-left: 20px; padding-right: 20px; font: 14px 'Times New Roman'; white-space: normal; letter-spacing: normal; height: auto; color: rgb(0,0,0); word-spacing: 0px; padding-top: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="panel_content"><pre style="margin: 0px; font-size: 14px"><div style="font-family: 'Courier New', Courier, monospace">3 2</div></pre></div><br class="Apple-interchange-newline" /> <div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img id="Codehighlighter1_0_34_Open_Image" onclick="this.style.display='none'; Codehighlighter1_0_34_Open_Text.style.display='none'; Codehighlighter1_0_34_Closed_Image.style.display='inline'; Codehighlighter1_0_34_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_0_34_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_0_34_Closed_Text.style.display='none'; Codehighlighter1_0_34_Open_Image.style.display='inline'; Codehighlighter1_0_34_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif"><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_0_34_Closed_Text">/**/</span><span id="Codehighlighter1_0_34_Open_Text"><span style="color: #008000">/*</span><span style="color: #008000">鐘舵佹柟紼嬶細F[I]=MAX(F[I-1]+A[I],A[I])</span><span style="color: #008000">*/</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" />#include</span><span style="color: #000000"><</span><span style="color: #000000">stdio.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" />#include</span><span style="color: #000000"><</span><span style="color: #0000ff">string</span><span style="color: #000000">.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" />#include</span><span style="color: #000000"><</span><span style="color: #000000">stdlib.h</span><span style="color: #000000">></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">#define</span><span style="color: #000000"> MAX 100000</span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000"> dp[MAX];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000"> sum[MAX];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000"> a[</span><span style="color: #000000">2</span><span style="color: #000000">*</span><span style="color: #000000">MAX];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000"> max(</span><span style="color: #0000ff">int</span><span style="color: #000000"> a,</span><span style="color: #0000ff">int</span><span style="color: #000000"> b)<br /><img id="Codehighlighter1_173_193_Open_Image" onclick="this.style.display='none'; Codehighlighter1_173_193_Open_Text.style.display='none'; Codehighlighter1_173_193_Closed_Image.style.display='inline'; Codehighlighter1_173_193_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_173_193_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_173_193_Closed_Text.style.display='none'; Codehighlighter1_173_193_Open_Image.style.display='inline'; Codehighlighter1_173_193_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_173_193_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_173_193_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #0000ff">return</span><span style="color: #000000"> a</span><span style="color: #000000">></span><span style="color: #000000">b</span><span style="color: #000000">?</span><span style="color: #000000"> a:b;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span><span style="color: #0000ff">int</span><span style="color: #000000"> main()<br /><img id="Codehighlighter1_206_957_Open_Image" onclick="this.style.display='none'; Codehighlighter1_206_957_Open_Text.style.display='none'; Codehighlighter1_206_957_Closed_Image.style.display='inline'; Codehighlighter1_206_957_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_206_957_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_206_957_Closed_Text.style.display='none'; Codehighlighter1_206_957_Open_Image.style.display='inline'; Codehighlighter1_206_957_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif"></span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_206_957_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_206_957_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #0000ff">int</span><span style="color: #000000"> i,a1,a2,n;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />    </span><span style="color: #0000ff">while</span><span style="color: #000000">(scanf(</span><span style="color: #000000">"</span><span style="color: #000000">%d</span><span style="color: #000000">"</span><span style="color: #000000">,</span><span style="color: #000000">&</span><span style="color: #000000">n)</span><span style="color: #000000">!=</span><span style="color: #000000">EOF)<br /><img id="Codehighlighter1_253_955_Open_Image" onclick="this.style.display='none'; Codehighlighter1_253_955_Open_Text.style.display='none'; Codehighlighter1_253_955_Closed_Image.style.display='inline'; Codehighlighter1_253_955_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_253_955_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_253_955_Closed_Text.style.display='none'; Codehighlighter1_253_955_Open_Image.style.display='inline'; Codehighlighter1_253_955_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">    </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_253_955_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_253_955_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        memset(dp,</span><span style="color: #000000">0</span><span style="color: #000000">,</span><span style="color: #0000ff">sizeof</span><span style="color: #000000">(dp));<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        </span><span style="color: #0000ff">int</span><span style="color: #000000"> num;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        </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_314_366_Open_Image" onclick="this.style.display='none'; Codehighlighter1_314_366_Open_Text.style.display='none'; Codehighlighter1_314_366_Closed_Image.style.display='inline'; Codehighlighter1_314_366_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_314_366_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_314_366_Closed_Text.style.display='none'; Codehighlighter1_314_366_Open_Image.style.display='inline'; Codehighlighter1_314_366_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">        </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_314_366_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_314_366_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            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">a1,</span><span style="color: #000000">&</span><span style="color: #000000">a2);<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            a[i]</span><span style="color: #000000">=</span><span style="color: #000000">a[i</span><span style="color: #000000">+</span><span style="color: #000000">n]</span><span style="color: #000000">=</span><span style="color: #000000">a1</span><span style="color: #000000">-</span><span style="color: #000000">a2;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />        }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        </span><span style="color: #0000ff">if</span><span style="color: #000000">(a[</span><span style="color: #000000">0</span><span style="color: #000000">]</span><span style="color: #000000">>=</span><span style="color: #000000">0</span><span style="color: #000000">)<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            dp[</span><span style="color: #000000">0</span><span style="color: #000000">]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        sum[</span><span style="color: #000000">0</span><span style="color: #000000">]</span><span style="color: #000000">=</span><span style="color: #000000">a[</span><span style="color: #000000">0</span><span style="color: #000000">];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        num</span><span style="color: #000000">=</span><span style="color: #000000">dp[</span><span style="color: #000000">0</span><span style="color: #000000">];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        </span><span style="color: #0000ff">for</span><span style="color: #000000">(i</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;i</span><span style="color: #000000"><</span><span style="color: #000000">2</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_445_929_Open_Image" onclick="this.style.display='none'; Codehighlighter1_445_929_Open_Text.style.display='none'; Codehighlighter1_445_929_Closed_Image.style.display='inline'; Codehighlighter1_445_929_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_445_929_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_445_929_Closed_Text.style.display='none'; Codehighlighter1_445_929_Open_Image.style.display='inline'; Codehighlighter1_445_929_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">        </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_445_929_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_445_929_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            </span><span style="color: #0000ff">if</span><span style="color: #000000">(num</span><span style="color: #000000">==</span><span style="color: #000000">n)<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                </span><span style="color: #0000ff">break</span><span style="color: #000000">;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            </span><span style="color: #0000ff">if</span><span style="color: #000000">(a[i]</span><span style="color: #000000">>=</span><span style="color: #000000">0</span><span style="color: #000000">)<br /><img id="Codehighlighter1_490_701_Open_Image" onclick="this.style.display='none'; Codehighlighter1_490_701_Open_Text.style.display='none'; Codehighlighter1_490_701_Closed_Image.style.display='inline'; Codehighlighter1_490_701_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_490_701_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_490_701_Closed_Text.style.display='none'; Codehighlighter1_490_701_Open_Image.style.display='inline'; Codehighlighter1_490_701_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">            </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_490_701_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_490_701_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                </span><span style="color: #0000ff">if</span><span style="color: #000000">(sum[i</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">]</span><span style="color: #000000">>=</span><span style="color: #000000">0</span><span style="color: #000000">)<br /><img id="Codehighlighter1_516_643_Open_Image" onclick="this.style.display='none'; Codehighlighter1_516_643_Open_Text.style.display='none'; Codehighlighter1_516_643_Closed_Image.style.display='inline'; Codehighlighter1_516_643_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_516_643_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_516_643_Closed_Text.style.display='none'; Codehighlighter1_516_643_Open_Image.style.display='inline'; Codehighlighter1_516_643_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">                </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_516_643_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_516_643_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    <br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    dp[i]</span><span style="color: #000000">=</span><span style="color: #000000">dp[i</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">]</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    </span><span style="color: #008000">//</span><span style="color: #008000">if(num<=dp[i])<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    </span><span style="color: #008000">//</span><span style="color: #008000">    num=dp[i];</span><span style="color: #008000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">                    num</span><span style="color: #000000">=</span><span style="color: #000000">max(dp[i],num);<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    sum[i]</span><span style="color: #000000">=</span><span style="color: #000000">sum[i</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">]</span><span style="color: #000000">+</span><span style="color: #000000">a[i];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />                }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                </span><span style="color: #0000ff">else</span><span style="color: #000000"><br /><img id="Codehighlighter1_658_696_Open_Image" onclick="this.style.display='none'; Codehighlighter1_658_696_Open_Text.style.display='none'; Codehighlighter1_658_696_Closed_Image.style.display='inline'; Codehighlighter1_658_696_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_658_696_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_658_696_Closed_Text.style.display='none'; Codehighlighter1_658_696_Open_Image.style.display='inline'; Codehighlighter1_658_696_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">                </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_658_696_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_658_696_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    sum[i]</span><span style="color: #000000">=</span><span style="color: #000000">a[i];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    dp[i]</span><span style="color: #000000">=</span><span style="color: #000000">1</span><span style="color: #000000">;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />                }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />            }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />            </span><span style="color: #0000ff">else</span><span style="color: #000000"><br /><img id="Codehighlighter1_714_925_Open_Image" onclick="this.style.display='none'; Codehighlighter1_714_925_Open_Text.style.display='none'; Codehighlighter1_714_925_Closed_Image.style.display='inline'; Codehighlighter1_714_925_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_714_925_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_714_925_Closed_Text.style.display='none'; Codehighlighter1_714_925_Open_Image.style.display='inline'; Codehighlighter1_714_925_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">            </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_714_925_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_714_925_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                </span><span style="color: #0000ff">if</span><span style="color: #000000">(sum[i</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">]</span><span style="color: #000000">+</span><span style="color: #000000">a[i]</span><span style="color: #000000">>=</span><span style="color: #000000">0</span><span style="color: #000000">)<br /><img id="Codehighlighter1_745_866_Open_Image" onclick="this.style.display='none'; Codehighlighter1_745_866_Open_Text.style.display='none'; Codehighlighter1_745_866_Closed_Image.style.display='inline'; Codehighlighter1_745_866_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_745_866_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_745_866_Closed_Text.style.display='none'; Codehighlighter1_745_866_Open_Image.style.display='inline'; Codehighlighter1_745_866_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">                </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_745_866_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_745_866_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    dp[i]</span><span style="color: #000000">=</span><span style="color: #000000">dp[i</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">]</span><span style="color: #000000">+</span><span style="color: #000000">1</span><span style="color: #000000">;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    </span><span style="color: #008000">//</span><span style="color: #008000">if(num<=dp[i])<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    </span><span style="color: #008000">//</span><span style="color: #008000">    num=dp[i];</span><span style="color: #008000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" /></span><span style="color: #000000">                    num</span><span style="color: #000000">=</span><span style="color: #000000">max(dp[i],num);<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    sum[i]</span><span style="color: #000000">=</span><span style="color: #000000">sum[i</span><span style="color: #000000">-</span><span style="color: #000000">1</span><span style="color: #000000">]</span><span style="color: #000000">+</span><span style="color: #000000">a[i];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />                }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                </span><span style="color: #0000ff">else</span><span style="color: #000000"> <br /><img id="Codehighlighter1_882_920_Open_Image" onclick="this.style.display='none'; Codehighlighter1_882_920_Open_Text.style.display='none'; Codehighlighter1_882_920_Closed_Image.style.display='inline'; Codehighlighter1_882_920_Closed_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif"><img style="display: none" id="Codehighlighter1_882_920_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_882_920_Closed_Text.style.display='none'; Codehighlighter1_882_920_Open_Image.style.display='inline'; Codehighlighter1_882_920_Open_Text.style.display='inline';" align="top" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif">                </span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_882_920_Closed_Text"><img src="http://www.tkk7.com/Images/dot.gif" alt="" /></span><span id="Codehighlighter1_882_920_Open_Text"><span style="color: #000000">{<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    dp[i]</span><span style="color: #000000">=</span><span style="color: #000000">0</span><span style="color: #000000">;<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />                    sum[i]</span><span style="color: #000000">=</span><span style="color: #000000">a[i];<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />                }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />            }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />        }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" alt="" />        printf(</span><span style="color: #000000">"</span><span style="color: #000000">%d\n</span><span style="color: #000000">"</span><span style="color: #000000">,num);<br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" alt="" />    }</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" alt="" />}</span></span><span style="color: #000000"><br /><img align="top" src="http://www.tkk7.com/images/OutliningIndicators/None.gif" alt="" /></span></div><br />鏈鐩彲浠ョ敤DP鍋氫篃鍙互涓嶇敤錛宒p鐨勮瘽鏄負鏈闀垮叕鍏卞瓙搴忓垪錛岃寰楁槸寰幆灝辮銆?<img src ="http://www.tkk7.com/Person/aggbug/396571.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/Person/" target="_blank">澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?</a> 2013-03-18 09:45 <a href="http://www.tkk7.com/Person/archive/2013/03/18/396571.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>HDU 2955 棰?Robberieshttp://www.tkk7.com/Person/archive/2013/02/16/395333.html澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢?Sat, 16 Feb 2013 14:15:00 GMThttp://www.tkk7.com/Person/archive/2013/02/16/395333.htmlhttp://www.tkk7.com/Person/comments/395333.htmlhttp://www.tkk7.com/Person/archive/2013/02/16/395333.html#Feedback0http://www.tkk7.com/Person/comments/commentRss/395333.htmlhttp://www.tkk7.com/Person/services/trackbacks/395333.htmlProblem Description
The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to work in the lucrative business of bank robbery only for a short while, before retiring to a comfortable job at a university.


For a few months now, Roy has been assessing the security of various banks and the amount of cash they hold. He wants to make a calculated risk, and grab as much money as possible.


His mother, Ola, has decided upon a tolerable probability of getting caught. She feels that he is safe enough if the banks he robs together give a probability less than this.
 

Input
The first line of input gives T, the number of cases. For each scenario, the first line of input gives a floating point number P, the probability Roy needs to be below, and an integer N, the number of banks he has plans for. Then follow N lines, where line j gives an integer Mj and a floating point number Pj . 
Bank j contains Mj millions, and the probability of getting caught from robbing it is Pj .
 

Output
For each test case, output a line with the maximum number of millions he can expect to get while the probability of getting caught is less than the limit set.

Notes and Constraints
0 < T <= 100
0.0 <= P <= 1.0
0 < N <= 100
0 < Mj <= 100
0.0 <= Pj <= 1.0
A bank goes bankrupt if it is robbed, and you may assume that all probabilities are independent as the police have very low funds.
 

Sample Input
3 0.04 3 1 0.02 2 0.03 3 0.05 0.06 3 2 0.03 2 0.03 3 0.05 0.10 3 1 0.03 2 0.02 3 0.05
 

Sample Output
2 4 6






澶℡U鍦癬__鍩圭敓錛屼唬鐮佷漢鐢? 2013-02-16 22:15 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 免费人成视频x8x8入口| 久久精品九九亚洲精品| 麻豆精品不卡国产免费看| 亚洲色图在线观看| 67194成是人免费无码| 一级做α爱过程免费视频| 日韩精品一区二区亚洲AV观看| 毛片a级毛片免费播放下载| 一级人做人爰a全过程免费视频| 亚洲一区二区中文| 免费A级毛片无码A| 最近中文字幕免费完整| 久久精品亚洲日本波多野结衣 | 亚洲熟妇无码八AV在线播放| 7x7x7x免费在线观看| 美女露隐私全部免费直播| 久久亚洲AV无码精品色午夜| 四虎影视免费永久在线观看| 91福利免费视频| 一本久久A久久免费精品不卡| 亚洲13又紧又嫩又水多| 久久久久亚洲AV无码专区网站| 西西大胆无码视频免费| 国产精品网站在线观看免费传媒| 亚洲成a人片在线观看天堂无码 | 99亚洲男女激情在线观看| 911精品国产亚洲日本美国韩国 | 成人一a毛片免费视频| 三年片在线观看免费观看大全动漫| 亚洲熟妇av午夜无码不卡| 亚洲Av无码专区国产乱码DVD| 免费国产在线观看| 毛色毛片免费观看| 99免费观看视频| 中文精品人人永久免费| 羞羞漫画小舞被黄漫免费| 亚洲熟妇无码一区二区三区| 亚洲免费黄色网址| 911精品国产亚洲日本美国韩国 | 免费av欧美国产在钱| 99视频有精品视频免费观看|