|
<p>In the not so distant future the world is populated by robots and ruled by an evil robot emperor. Every robot in the world can be identified by a unique numeric ID, and the list of all the existing robot IDs is easily accessible to everyone. |
|
One day the emperor decided to call for a general election to preserve an illusion of democracy. He set it up in the following way:<p> |
|
<ul> |
|
<li> - Every robot can cast at most one vote per round of voting and the votes are anonymous.</li> |
|
<li> - The only option on the ballot is the vote for reelection of the emperor.</li> |
|
<li> - If at least <strong>P</strong> percent of the population cast votes for the emperor he becomes reelected for the next millennium.</li> |
|
<li> - Otherwise the emperor declares the vote void, disassembles <strong>K</strong> robots with the lowest ID numbers (who he finds to be the most rebellious), and then if there are any functional robots left he restarts the whole process.</li> |
|
</ul> |
|
<p> |
|
All the robots are perfectly logical but also rather lazy and prone to procrastination. That's why after figuring out the plan of the emperor, they will abstain from voting unless they have to vote to survive the election (including this round and all later rounds). If they will die whether or not they vote, they will vote in the hope that the emperor will spare them. (He won't, because he's evil!). |
|
</p> |
|
<h2>Problem</h2> |
|
<p> |
|
Given <strong>N</strong> - the initial population size, <strong>K</strong> - the number of robots disassembled after an unsuccessful vote and <strong>P</strong> - the required percentage of votes.</p><p> Compute the number of times the vote will take place. </p> |
|
|
|
<h2>Input</h2> |
|
<p>The first line contains the number of test cases <strong>T</strong>, where <strong> 1 ≤ T ≤ 100 </strong></p> |
|
<p>Each case is a single line with three space-separated integers <strong>N</strong> <strong>K</strong> <strong>P</strong></p> |
|
<p>0 < <strong>K</strong> ≤ <strong>N</strong> ≤ 1,000,000,000,000 <br/> |
|
0 < <strong>P</strong> ≤ 100</p> |
|
|
|
<h2>Output</h2> |
|
<p>For test case <strong>i</strong>, numbered from <strong>1</strong> to <strong>T</strong>, output "Case #i: ", followed by a single integer, the number of times the emperor will have to call a vote before getting reelected. |
|
|
|
<h2>Example</h2> |
|
<p>In the first case we have three robots. Two of them are facing disassembly, so they will vote for the emperor. The third robot will survive even if he abstains in the first round, so he doesn't vote. But two out of three is not enough to reach the 75% minimum, so the election proceeds to a second round. The election ends when the single remaining robot casts a vote for the emperor.</p> |
|
<p>In the second case again two robots are in immediate danger, but the next two robots are forced to vote as well, otherwise they would end up in the same situation as in the first example case. Now with the 4 out of 5 casting the vote the election successfully ends.</p> |
|
|
|
|
|
|