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

inputoutput
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;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值