## unknown

BAN USER- 0of 0 votes

AnswersYou are given C containers, B black balls and an unlimited number of white balls. You want to distribute balls between the containers in a way that every container contains at least one ball and the probability of selecting a white ball is greater or equal to P percent. The selection is done by randomly picking a container followed by randomly picking a ball from it.

- unknown in United States

Find the minimal required number of white balls to achieve that.

INPUT

The first line contains 1 <= T <= 10 - the number of testcases.

Each of the following T lines contain three integers C B P separated by a single space 1<= C <= 1000; 0 <= B <= 1000; 0 <= P <= 100;

OUTPUT

For each testcase output a line containing an integer - the minimal number of white balls required. (The tests will assure that it's possible with a finite number of balls)

SAMPLE INPUT

3

1 1 60

2 1 60

10 2 50

SAMPLE OUTPUT

2

2

8

EXPLANATION

In the 1st testcase if we put 2 white balls and 1 black ball in the box the probability of selecting a white one is 66.(6)% which is greater than 60%

In the 2nd testcase putting a single white ball in one box and white+black in the other gives us 0.5 * 100% + 0.5 * 50% = 75%

For the 3rd testcase remember that we want at least one ball in each of the boxes.| Report Duplicate | Flag | PURGE

Facebook Software Engineer / Developer Algorithm Probability

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

It can be solved with bitmask .. Firstly we take a copy of bits in n & m and replace them .. here is a simple code

- unknown September 13, 2011