zoukankan      html  css  js  c++  java
  • ural 1011. Conductors

    1011. Conductors

    Time Limit: 2.0 second
    Memory Limit: 64 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 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 <cstdio>
    #include <cmath>
    #include <algorithm>
    #define EPS 10e-8
    
    using namespace std;int main(){
        double p,q;
        cin >>p>>q;
        double  k = 1;
        p+=EPS;q-=EPS;
        while(1){
            int a = int(k*p)/100,b=int(k*q)/100;
            //cout<<ceil(a)<<" "<<floor(b)<<endl;
            if(a!=b) break;
            k++;
        }
        cout<< k<<endl;
        return 0;
    }
    
  • 相关阅读:
    如何使用VS2013进行单元测试和查看代码覆盖率
    荔枝架构演进历程读后感
    关于海尔电商峰值系统架构读后感
    苏宁易购:商品详情系统架构设计读后感
    第二阶段冲刺第四天
    第二阶段冲刺第五天
    第二阶段冲刺第三天
    第二阶段冲刺第二天
    第二阶段冲刺第一天
    第一阶段末尾
  • 原文地址:https://www.cnblogs.com/xiongqiangcs/p/3035763.html
Copyright © 2011-2022 走看看