Files
PAT/source/html/b1037.html
T

19 lines
3.6 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
在霍格沃茨找零钱
<div class="ques-view"><p>如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱 <span class="katex"><span class="katex-mathml"><math><mrow><mi>P</mi></mrow>P</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.13889em;">P</span></span></span></span> 和他实付的钱 <span class="katex"><span class="katex-mathml"><math><mrow><mi>A</mi></mrow>A</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit">A</span></span></span></span>,你的任务是写一个程序来计算他应该被找的零钱。</p>
<h3 id="-">输入格式:</h3>
<p>输入在 1 行中分别给出 <span class="katex"><span class="katex-mathml"><math><mrow><mi>P</mi></mrow>P</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit" style="margin-right:0.13889em;">P</span></span></span></span> 和 <span class="katex"><span class="katex-mathml"><math><mrow><mi>A</mi></mrow>A</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.68333em;"></span><span class="strut bottom" style="height:0.68333em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathit">A</span></span></span></span>,格式为 <code>Galleon.Sickle.Knut</code>,其间用 1 个空格分隔。这里 <code>Galleon</code> 是 [0, <span class="katex"><span class="katex-mathml"><math><mrow><mn>1</mn><msup><mn>0</mn><mn>7</mn></msup></mrow>10^7</math></span><span aria-hidden="true" class="katex-html"><span class="strut" style="height:0.8141079999999999em;"></span><span class="strut bottom" style="height:0.8141079999999999em;vertical-align:0em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mord"><span class="mord mathrm">0</span><span class="msupsub"><span class="vlist"><span style="top:-0.363em;margin-right:0.05em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped mtight"><span class="mord mathrm mtight">7</span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span></span></span></span></span>] 区间内的整数,<code>Sickle</code> 是 [0, 17) 区间内的整数,<code>Knut</code> 是 [0, 29) 区间内的整数。</p>
<h3 id="-">输出格式:</h3>
<p>在一行中用与输入同样的格式输出哈利应该被找的零钱。如果他没带够钱,那么输出的应该是负数。</p>
<h3 id="-1-">输入样例 1:</h3>
<pre><code class="lang-in">10.16.27 14.1.28
</code></pre>
<h3 id="-1-">输出样例 1:</h3>
<pre><code class="lang-out">3.2.1
</code></pre>
<h3 id="-2-">输入样例 2:</h3>
<pre><code class="lang-in">14.1.28 10.16.27
</code></pre>
<h3 id="-2-">输出样例 2:</h3>
<pre><code class="lang-out">-3.2.1
</code></pre>
</div>