天天看點

URAL1011:Conductors

Background

Everyone making translations from English to Russian knows an English phrase "Naked conductor runs along the bus". It has two very different meanings.

Problem

Every bus in the Ekaterinburg city has a special man (or woman) called conductor. When you ride the bus, you have to give money to the conductor. We know that there are more than P% conductors and less than Q% conductors of all citizens of Ekaterinburg. Your task is to determine a minimal possible number of Ekaterinburg citizens. By percentage, we know that there are more than P% conductors and less than Q% conductors of all Russian citizens in this city

Input

Two numbers P, Q such that 0.01 ≤ P, Q ≤ 99.99. Numbers are given with 2 digits precision. These numbers are separated by some spaces or "end of line" symbols.

Output

The minimal number of Ekaterinburg citizens.

Sample

input output
13
14.1
      
15      

Hint

If there are 15 citizens and 2 conductors among them in Ekaterinburg, then there are 13 1/3 % conductors of all citizens.   給出售票員占全市人口的百分比的上限與下限,求出全市人口的最小數目,要注意不能包括上限與下限,還有精度。。。  

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
double p,q,l,r;
int L,R,ans;

int main()
{
    while(cin>>p>>q)
    {
        ans = 1;
        while(1)
        {
            l = ans*p/100.0;
            r = ans*q/100.0;
            L = (int)l;
            R = (int)r;
            if(R>L && fabs(l-L)>1e-6 && fabs(r-R)>1e-6)
            {
                cout<<ans<<endl;
                break;
            }
            ans++;
        }
    }

    return 0;
}