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
  1. 13
  2. 14.1
  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 就认为不同了
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main()
  5. {
  6. double p,q;
  7. double l,r;
  8. while (scanf("%lf%lf",&p,&q)!=EOF)
  9. {
  10. for (int i=;i<=;i++)
  11. {
  12. l=i*p/;
  13. r=i*q/;
  14. int L=floor(l);
  15. int R=floor(r);
  16. if (R-L>=&&fabs(l-L)>1e-&&fabs(r-R)>1e-)
  17. {
  18. printf("%d\n",i);
  19. break;
  20. }
  21. }
  22. }
  23. return ;
  24. }
 
 
 
 
 
 
 

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. iOS:UICollectionView纯自定义的布局:瀑布流布局

    创建瀑布流有三种方式:   第一种方式:在一个ScrollView里面放入三个单元格高度一样的tableView,禁止tableView滚动,只需让tableView随着ScrollView滚动即可. ...

  2. mongodb修改器(转)

    MongoDB 修改器 对文档中的某些字段进行更新 $inc 专门用来增加(或减少)数字的,只能用于整数,长整数或双精度浮点型的值$inc键的值必须为数字,不能使用字符串,数组或其他非数字的值如果键不 ...

  3. BindVertexbuffer

    stride 的意思是 inputstream.layout 的大小 比如 description是 pos uv normal stride 就是一组pos uv normal的大小 ns  里面 ...

  4. 在ecshop中添加页面,并且实现后台管理

    后台一共需要修改下面的四个文件 admin/template.php admin/includes/lib_template.php languages/zh_cn/admin/template.ph ...

  5. Java 二分法查找

    算法:当数据量很大适宜采用该方法.采用二分法查找时,数据需是有序不重复的. 基本思想:假设数据是按升序排序的,对于给定值 x,从序列的中间位置开始比较,如果当前位置值等于 x,则查找成功:若 x 小于 ...

  6. springboot 有用网址收集

    http://www.ityouknow.com/spring-boot.html springboot多数据源配置: https://blog.csdn.net/neosmith/article/d ...

  7. vue-router 导航守卫

    记住参数或查询的改变并不会触发进入/离开的导航守卫.你可以通过观察 $route 对象来应对这些变化,或使用 beforeRouteUpdate 的组件内守卫. 1.全局守卫 const router ...

  8. 怎样在QML应用中调用系统设置中的页面来设置我们的系统

    我们在QML应用中有时须要调用系统设置(system settings)来完毕我们的一些设置.比方,我们在使用GPS来定位时,可能GPS并没有打开,假设在我们的应用中直接打开系统中的GPS设置页面,这 ...

  9. cocos2d-x 3.0 回调函数

    參考文章: http://blog.csdn.net/crayondeng/article/details/18767407 http://blog.csdn.net/star530/article/ ...

  10. PIVOT 和 UPIVOT 的使用(行转列)

    PIVOT 通过将表达式某一列中的唯一值转换为输出中的多个列来旋转表值表达式,并在必要时对最终输出中所需的任何其余列值执行聚合.UNPIVOT 与 PIVOT 执行相反的操作,将表值表达式的列转换为列 ...