1011. Conductors
Time Limit: 2.0 second
Memory Limit: 16 MB
Memory Limit: 16 MB
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. Your task is to determine a minimal possible number of Ekaterinburg citizens.
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 |
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
double p, q, i;
cin>>p>>q;
p = p * 0.01 + 1e-8; //严格按照题目要求
q = q * 0.01 - 1e-8;
for (i=1; floor(i*q) - ceil(i*p)<0; i++);
cout<<i<<endl;
}