悬赏园豆:30
[已关闭问题]
关闭于 2009-05-03 10:17
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-pagination: widow-orphan; mso-outline-level: 1;" align="center"><strong><span style="font-size: 24pt; color: #1a5cc8; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 18.0pt;" lang="EN-US">FatMouse' Trade</span></strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 12pt; text-align: center; mso-pagination: widow-orphan;" align="center"><strong><span style="font-size: 7.5pt; color: green; font-family: "Arial","sans-serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 6718 Accepted Submission(s): 1935<br style="mso-special-character: line-break;" /><br style="mso-special-character: line-break;" /></span></strong><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><strong><span style="font-size: 11.5pt; color: #7ca9ed; font-family: "Arial","sans-serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">Problem Description</span></strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.<br />The warehouse has N rooms. The i-th room contains J[i] pounds of JavaBeans and requires F[i] pounds of cat food. FatMouse does not have to trade for all the JavaBeans in the room, instead, he may get J[i]* a% pounds of JavaBeans if he pays F[i]* a% pounds of cat food. Here a is a real number. Now he is assigning this homework to you: tell him the maximum amount of JavaBeans he can obtain.</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><strong><span style="font-size: 11.5pt; color: #7ca9ed; font-family: "Arial","sans-serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">Input</span></strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">The input consists of multiple test cases. Each test case begins with a line containing two non-negative integers M and N. Then N lines follow, each contains two non-negative integers J[i] and F[i] respectively. The last test case is followed by two -1's. All integers are not greater than 1000.</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><strong><span style="font-size: 11.5pt; color: #7ca9ed; font-family: "Arial","sans-serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">Output</span></strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">For each test case, print in a single line a real number accurate up to 3 decimal places, which is the maximum amount of JavaBeans that FatMouse can obtain.</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><strong><span style="font-size: 11.5pt; color: #7ca9ed; font-family: "Arial","sans-serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">Sample Input</span></strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">5 3</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">7 2</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">4 3</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">5 2</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">20 3</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">25 18</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">24 15</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">15 10</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">-1 -1</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: center; mso-pagination: widow-orphan;" align="center"><span style="font-size: 9pt; font-family: "Times New Roman","serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan;" align="left"><strong><span style="font-size: 11.5pt; color: #7ca9ed; font-family: "Arial","sans-serif"; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt;" lang="EN-US">Sample Output</span></strong></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">13.333</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">31.500</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"> </p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">我的代码是:</span></p>
<p><span style="font-size: 9pt; font-family: 宋体; mso-font-kerning: 0pt; mso-bidi-font-family: 宋体;" lang="EN-US">
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"> </p>
</span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"> </p>
<div class="cnblogs_code">
<pre><img id="Code_Closed_Image_103501" style="display: none" onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_103501').style.display='none'; document.getElementById('Code_Open_Image_103501').style.display='inline'; document.getElementById('Code_Open_Text_103501').style.display='inline';" src="/Images/OutliningIndicators/ContractedBlock.gif" alt="" width="11" height="16" align="top" /><img id="Code_Open_Image_103501" onclick="this.style.display='none'; document.getElementById('Code_Open_Text_103501').style.display='none'; getElementById('Code_Closed_Image_103501').style.display='inline'; getElementById('Code_Closed_Text_103501').style.display='inline';" src="/Images/OutliningIndicators/ExpandedBlockStart.gif" alt="" width="11" height="16" align="top" /><span id="Code_Closed_Text_103501" class="cnblogs_code_Collapse">Code</span><span id="Code_Open_Text_103501"><br /><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><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 />#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: #0000FF;">using</span><span style="color: #000000;"> </span><span style="color: #0000FF;">namespace</span><span style="color: #000000;"> std;<br /><br /></span><span style="color: #0000FF;">float</span><span style="color: #000000;"> Max(</span><span style="color: #0000FF;">float</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">f,</span><span style="color: #0000FF;">int</span><span style="color: #000000;">&</span><span style="color: #000000;"> index,</span><span style="color: #0000FF;">int</span><span style="color: #000000;"> length)<br />{<br /> </span><span style="color: #0000FF;">float</span><span style="color: #000000;"> max</span><span style="color: #000000;">=</span><span style="color: #800080;">0.0</span><span style="color: #000000;">;<br /> </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: #800080;">0</span><span style="color: #000000;">;i</span><span style="color: #000000;"><</span><span style="color: #000000;">length;i</span><span style="color: #000000;">++</span><span style="color: #000000;">)<br /> {<br /> </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(f[i]</span><span style="color: #000000;">></span><span style="color: #000000;">max)<br /> {<br /> max</span><span style="color: #000000;">=</span><span style="color: #000000;">f[i];<br /> index</span><span style="color: #000000;">=</span><span style="color: #000000;">i;<br /> }<br /> }<br /> </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> max;<br />}<br /><br /></span><span style="color: #0000FF;">int</span><span style="color: #000000;"> main()<br />{<br /> </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> M,N,</span><span style="color: #000000;">*</span><span style="color: #000000;">mfood,</span><span style="color: #000000;">*</span><span style="color: #000000;">cfood,pos;<br /> </span><span style="color: #0000FF;">float</span><span style="color: #000000;"> </span><span style="color: #000000;">*</span><span style="color: #000000;">p,maxfood;<br /> </span><span style="color: #0000FF;">while</span><span style="color: #000000;">(scanf(</span><span style="color: #800000;">"</span><span style="color: #800000;">%d %d</span><span style="color: #800000;">"</span><span style="color: #000000;">,</span><span style="color: #000000;">&</span><span style="color: #000000;">M,</span><span style="color: #000000;">&</span><span style="color: #000000;">N)</span><span style="color: #000000;">!=</span><span style="color: #000000;">EOF</span><span style="color: #000000;">&&</span><span style="color: #000000;">M</span><span style="color: #000000;">!=-</span><span style="color: #800080;">1</span><span style="color: #000000;">&&</span><span style="color: #000000;">N</span><span style="color: #000000;">!=-</span><span style="color: #800080;">1</span><span style="color: #000000;">)<br /> {<br /> p</span><span style="color: #000000;">=</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> </span><span style="color: #0000FF;">float</span><span style="color: #000000;">[N];<br /> cfood</span><span style="color: #000000;">=</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> </span><span style="color: #0000FF;">int</span><span style="color: #000000;">[N];<br /> mfood</span><span style="color: #000000;">=</span><span style="color: #0000FF;">new</span><span style="color: #000000;"> </span><span style="color: #0000FF;">int</span><span style="color: #000000;">[N];<br /> pos</span><span style="color: #000000;">=</span><span style="color: #800080;">0</span><span style="color: #000000;">;<br /> maxfood</span><span style="color: #000000;">=</span><span style="color: #800080;">0</span><span style="color: #000000;">;<br /> </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: #800080;">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 /> {<br /> scanf(</span><span style="color: #800000;">"</span><span style="color: #800000;">%d %d</span><span style="color: #800000;">"</span><span style="color: #000000;">,</span><span style="color: #000000;">&</span><span style="color: #000000;">mfood[i],</span><span style="color: #000000;">&</span><span style="color: #000000;">cfood[i]);<br /> </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(mfood[i]</span><span style="color: #000000;">==</span><span style="color: #800080;">0</span><span style="color: #000000;">&&</span><span style="color: #000000;">cfood[i]</span><span style="color: #000000;">!=</span><span style="color: #800080;">0</span><span style="color: #000000;">)<br /> p[i]</span><span style="color: #000000;">=</span><span style="color: #800080;">0.0</span><span style="color: #000000;">;<br /> </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(cfood[i]</span><span style="color: #000000;">==</span><span style="color: #800080;">0</span><span style="color: #000000;">&&</span><span style="color: #000000;">mfood[i]</span><span style="color: #000000;">!=</span><span style="color: #800080;">0</span><span style="color: #000000;">)<br /> p[i]</span><span style="color: #000000;">=</span><span style="color: #800080;">1001</span><span style="color: #000000;">;<br /> p[i]</span><span style="color: #000000;">=</span><span style="color: #000000;">mfood[i]</span><span style="color: #000000;">/</span><span style="color: #000000;">(</span><span style="color: #0000FF;">float</span><span style="color: #000000;">)cfood[i];<br /> }<br /> </span><span style="color: #0000FF;">int</span><span style="color: #000000;"> length</span><span style="color: #000000;">=</span><span style="color: #000000;">N;<br /> </span><span style="color: #0000FF;">while</span><span style="color: #000000;">(M</span><span style="color: #000000;">!=</span><span style="color: #800080;">0</span><span style="color: #000000;">&&</span><span style="color: #000000;">N</span><span style="color: #000000;">!=</span><span style="color: #800080;">0</span><span style="color: #000000;">)<br /> {<br /> </span><span style="color: #0000FF;">float</span><span style="color: #000000;"> pro</span><span style="color: #000000;">=</span><span style="color: #000000;">Max(p,pos,length);<br /> </span><span style="color: #0000FF;">if</span><span style="color: #000000;">(M</span><span style="color: #000000;">>=</span><span style="color: #000000;">cfood[pos])<br /> {<br /> maxfood</span><span style="color: #000000;">+=</span><span style="color: #000000;">mfood[pos];<br /> M</span><span style="color: #000000;">-=</span><span style="color: #000000;">cfood[pos];<br /> }<br /> </span><span style="color: #0000FF;">else</span><span style="color: #000000;"><br /> {<br /> maxfood</span><span style="color: #000000;">+=</span><span style="color: #000000;">(M</span><span style="color: #000000;">*</span><span style="color: #000000;">pro);<br /> M</span><span style="color: #000000;">=</span><span style="color: #800080;">0</span><span style="color: #000000;">;<br /> }<br /> N</span><span style="color: #000000;">--</span><span style="color: #000000;">;<br /> p[pos]</span><span style="color: #000000;">=</span><span style="color: #800080;">0.0</span><span style="color: #000000;">;<br /> }<br /> printf(</span><span style="color: #800000;">"</span><span style="color: #800000;">%.3f\n</span><span style="color: #800000;">"</span><span style="color: #000000;">,maxfood);<br /> delete []p;<br /> delete []cfood;<br /> delete []mfood;<br /> }<br /> </span><span style="color: #0000FF;">return</span><span style="color: #000000;"> </span><span style="color: #800080;">0</span><span style="color: #000000;">;<br />}<br /></span></span></pre>
</div>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left"> </p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-align: left; mso-pagination: widow-orphan; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;" align="left">我首先用mfood[],cfood[]保存了输入的对应鼠食和猫食,在用p[]保存每组对应的效益(或交易率)然后每次选出效益比最大的那组,计算maxfood;我也考虑了为0的情况,怎么就老是worry answer呢?</p>