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 PQ such that 0.01 ≤ PQ ≤ 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.

Example

input output
13
14.1
15

Notes

If there are 15 citizens and 2 conductors among them in Ekaterinburg, then there are 13 1/3 % conductors of all citizens.
 
 
 
//简单的题目,意思就是要 n 个售票员,all 是总人口 % < n / all * 100% < r % 问,满足这公式需要的最少的总人口是多少
要注意的其实就是 浮点数的比较,一般认为,两浮点数相差大于 10e-8 就认为不同了
 #include <stdio.h>
#include <math.h> int main()
{
double p,q;
double l,r;
while (scanf("%lf%lf",&p,&q)!=EOF)
{
for (int i=;i<=;i++)
{
l=i*p/;
r=i*q/;
int L=floor(l);
int R=floor(r);
if (R-L>=&&fabs(l-L)>1e-&&fabs(r-R)>1e-)
{
printf("%d\n",i);
break;
}
}
}
return ;
}
 
 
 
 
 
 
 

Conductors(水题)的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  3. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  4. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  5. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  6. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  7. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  8. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

  9. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

随机推荐

  1. ckeditor的详细配置(转)

    CKEditor 3 JavaScript API Documentation : http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.con ...

  2. ES6中的迭代器(Iterator)和生成器(Generator)(一)

    用循环语句迭代数据时,必须要初始化一个变量来记录每一次迭代在数据集合中的位置,而在许多编程语言中,已经开始通过程序化的方式用迭代器对象返回迭代过程中集合的每一个元素 迭代器的使用可以极大地简化数据操作 ...

  3. jstl的错误总结与解决方法

    哎,真他娘的无语了,jstl标签竟然还与tomcat的版本有关.一会报错:java.lang.AbstractMethodError: javax.servlet.jsp.PageContext.ge ...

  4. boolean类型的特殊的get和set方法

    public class D { private boolean a; public boolean isA() { return a; } public void setA(boolean a) { ...

  5. ElasticSearch refresh API

    在 Elasticsearch 中,写入和打开一个新段的轻量的过程叫做 refresh . 默认情况下每个分片会每秒自动刷新一次.这就是为什么我们说 Elasticsearch 是 近 实时搜索: 文 ...

  6. xpath节点匹配简易教程

    2017-03-23 非本人原创,只是写爬虫时很有用,就留下了 <A id="a1"> <B id="b1"> <C id=&qu ...

  7. ubuntu 查看系统服务的列表

    service --status-all

  8. QT静态库和动态库的导出

    因为静态库是不须要导出的.所以在写QT的前置声明的时候须要说明 #if defined(QT_SHARED) #ifdef COMMONLIB #define COMMONLIB_EXPORT Q_D ...

  9. htmlspecialchars_decode

    htmlspecialchars_decode   htmlspecialchars_decode - 将特殊的 HTML 实体转换回普通字符 htmlspecialchars - 将特殊字符转换为 ...

  10. lodash 展平数组 flatten flattenDeep

    _.flatten(array) 向上一级展平数组嵌套 <!DOCTYPE html> <html lang="zh"> <head> < ...