您的位置:首页 > 其它

URAL 1011(枚举)

2013-02-09 16:46 351 查看
题意:黑书P12 售货员

思路:不能有半个人。

#include <cstdio>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>

using namespace std;
const double EPS = 1e-12;
double  l,r;
bool zero(double t)
{
    return -EPS<t&&t<EPS;
}
bool find(int k)
{
    if((int)(l*k)<(int)(r*k)&&!zero((r*k)-(int)(r*k))) return true;
    return false;
}
int main()
{
    freopen("in.txt","r",stdin);
    while(~scanf("%lf%lf",&l,&r))
    {
        l/=100;r/=100;
        for(int i=1;;i++)
        {
            if(find(i))
            {
                printf("%d\n",i);
                break;
            }
        }
    }
    return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: