CF919A Supermarket

    • 226通过
    • 419提交
  • 题目来源 CodeForces 919A
  • 评测方式 RemoteJudge
  • 标签 排序 数论,数学 贪心
  • 难度 入门难度
  • 时空限制 2000ms / 256MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    题目描述:

    有m个超市,在第i个超市买b千克苹果需要花a元。也就是说,花a/b元可以买1kg苹果。每个超市都无限量供应苹果。你要买n千克苹果,问你最少花多少钱。

    输入:

    第一行两个正整数n和m(1<=n<=5000,1<=m<=100)

    接下来m行,每行两个正整数a和b(1<=a,b<=100)

    输出:

    一行一个实数,表示你最少花的钱。与标准答案的误差不能超过10^(-6)

    Translated by AKEE

    题目描述

    We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that $ a $ yuan for $ b $ kilos (You don't need to care about what "yuan" is), the same as $ a/b $ yuan for a kilo.

    Now imagine you'd like to buy $ m $ kilos of apples. You've asked $ n $ supermarkets and got the prices. Find the minimum cost for those apples.

    You can assume that there are enough apples in all supermarkets.

    输入输出格式

    输入格式:

    The first line contains two positive integers $ n $ and $ m $ ( $ 1<=n<=5000 $ , $ 1<=m<=100 $ ), denoting that there are $ n $ supermarkets and you want to buy $ m $ kilos of apples.

    The following $ n $ lines describe the information of the supermarkets. Each line contains two positive integers $ a,b $ ( $ 1<=a,b<=100 $ ), denoting that in this supermarket, you are supposed to pay $ a $ yuan for $ b $ kilos of apples.

    输出格式:

    The only line, denoting the minimum cost for $ m $ kilos of apples. Please make sure that the absolute or relative error between your answer and the correct answer won't exceed $ 10^{-6} $ .

    Formally, let your answer be $ x $ , and the jury's answer be $ y $ . Your answer is considered correct if .

    输入输出样例

    输入样例#1: 复制
    3 5
    1 2
    3 4
    1 3
    
    输出样例#1: 复制
    1.66666667
    
    输入样例#2: 复制
    2 1
    99 100
    98 99
    
    输出样例#2: 复制
    0.98989899
    

    说明

    In the first sample, you are supposed to buy $ 5 $ kilos of apples in supermarket $ 3 $ . The cost is $ 5/3 $ yuan.

    In the second sample, you are supposed to buy $ 1 $ kilo of apples in supermarket $ 2 $ . The cost is $ 98/99 $ yuan.

    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。