Algorithm


Problem Name: beecrowd | 1541

Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/1541

Building Houses

 

By Normandes Jr, UFU BR Brazil

Timelimit: 1

Mr Pi is a famous constructor of Codingland. He needs your help to find out the best lands in the city to his projects.

For instance, he has a project to build a house of 8 meters for 10 meters but, the city laws only allow build houses in this neighborhood, in maximum 20% of total area. All lands in this city are perfectly square. For your information the house side is showed only for you to know the house's area that will be built. (E.g: For a house with 1 meters by 10 meters, in a neighborhood that allows house use 100% of the land, Mr Pi would needed a land with 10 square meters. The land side in this case, should be 3.163 meters, that truncated it is 3). Help Mr Pi find out the ideal land for each project.

 

Input

 

The input has many test cases. Each one is made by three integer numbers A, B and C (> 0 and <= 1000) separated by one blank space. This numbers are the size of the house (A and B) and the maximum percentage allowed to build in this neighborhood (C). An unique 0 (zero) value means end of inputs.

 

Output

 

Should be printed an integer number, that is the size of the land. This value should be truncated.

 

 

 

Sample Input Sample Output

8 10 20
1 10 100
10 3 100
0

20
3
5

 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming


#include<stdio.h>
#include < math.h>
int main()
{
    int a,b,c,d,e,f;
    while(scanf("%d ",&a)!=EOF){
        if(a==0)break;
        scanf("%d %d",&b,&c);
        d=a*b;
        e=d*100/c;
        f=pow(e,.5);
        printf("%d\n",f);
    }
    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
8 10 20 1 10 100 10 3 100 0

Output

x
+
cmd
20 3 5

#2 Code Example with Javascript Programming

Code - Javascript Programming


var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');


let pegarValores = (line) => line.split(" ").map(a => Number(a));
let [A, B, C] = pegarValores(lines.shift());

    while (A > 0) {
        console.log (Math.floor (Math.sqrt ((A * B * 100) / C)));
        [A, B, C] = pegarValores(lines.shift());
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
8 10 20 1 10 100 10 3 100 0

Output

x
+
cmd
20 3 5
Advertisements

Demonstration


Previous
#1540 Beecrowd Online Judge Solution 1540 Energy Planning Solution in C, C++, Java, Js and Python
Next
#1542 Beecrowd Online Judge Solution 1542 Reading Books Solution in C, C++, Java, Js and Python