A. Supermarket

time limit per test2 seconds

memory limit per test256 megabytes

Problem Description

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.

Input

The first line contains two positive integers n and m (1 ≤ n ≤ 5 000, 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.

Output

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 .

Examples

input

3 5

1 2

3 4

1 3

output

1.66666667

input

2 1

99 100

98 99

output

0.98989899


解题心得:

  1. 一个水题,注意精度问题就可以轻松过了。

#include<bits/stdc++.h>
using namespace std;
int main()
{
double ans,a,b,m;
int n;
scanf("%d%lf",&n,&m);
ans = 10000000.0;
for(int i=0;i<n;i++)
{
scanf("%lf%lf",&a,&b);
ans = min(ans,m*a/b);
}
printf("%.8f",ans);
return 0;
}

Codeforces Round #460 (Div. 2)-A. Supermarket的更多相关文章

  1. 【Codeforces Round #460 (Div. 2) A】 Supermarket

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 就是让你求m*(ai/bb)的最小值 [代码] #include <bits/stdc++.h> #define dou ...

  2. Codeforces Round #460 (Div. 2) ABCDE题解

    原文链接http://www.cnblogs.com/zhouzhendong/p/8397685.html 2018-02-01 $A$ 题意概括 你要买$m$斤水果,现在有$n$个超市让你选择. ...

  3. Codeforces Round #460 (Div. 2)

    A. Supermarket We often go to supermarkets to buy some fruits or vegetables, and on the tag there pr ...

  4. [Codeforces]Codeforces Round #460 (Div. 2)

    Supermarket 找最便宜的就行 Solution Perfect Number 暴力做 Solution Seat Arrangement 注意当k=1时,横着和竖着是同一种方案 Soluti ...

  5. Codeforces Round #460 (Div. 2) E. Congruence Equation (CRT+数论)

    题目链接: http://codeforces.com/problemset/problem/919/E 题意: 让你求满足 \(na^n\equiv b \pmod p\) 的 \(n\) 的个数. ...

  6. Codeforces Round #460 (Div. 2)-A Supermaket(贪心)

    A. Supermarket time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  7. Codeforces Round #460 (Div. 2) 前三题

    Problem A:题目传送门 题目大意:给你N家店,每家店有不同的价格卖苹果,ai元bi斤,那么这家的苹果就是ai/bi元一斤,你要买M斤,问最少花多少元. 题解:贪心,找最小的ai/bi. #in ...

  8. Codeforces Round #460 (Div. 2): D. Substring(DAG+DP+判环)

    D. Substring time limit per test 3 seconds memory limit per test 256 megabytes input standard input ...

  9. Codeforces Round #460 (Div. 2).E 费马小定理+中国剩余定理

    E. Congruence Equation time limit per test 3 seconds memory limit per test 256 megabytes input stand ...

随机推荐

  1. 修改response,报错Cannot call getWriter(), getOutputStream() already called

    往response里面改数据,然后系统报这个错 此时直接return null即可解决 但是,要想返回相应的页面呢? 可以直接在response里设置返回的页面

  2. MVC学习6 学习使用Code First Migrations功能 把Model的更新同步到DB中

     参考:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-new-field-to-th ...

  3. Oracle单列函数

    --字符函数--1.ASCII 返回与指定的字符对应的十进制数;select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space fr ...

  4. wepy-cli 开发小程序如何使用vant组件

    同样使用wepy-cli快速生成的小程序,目前可以使用组件: 直接通过 git 下载 Vant Weapp 源代码,并将dist目录拷贝到自己的项目中 git clone https://github ...

  5. 动态页面技术----EL技术、JSTL技术,javaEE的开发模式

    1 EL技术 1.1 EL 表达式 EL(Express Lanuage)表达式可以嵌入在jsp页面内部,减少jsp脚本的编写, EL出现的目的是要替代jsp页面中脚本的编写,就是简化java代码. ...

  6. linux修改系统时间为北京时间(CentOS)

    删除本地时间 rm -rf /etc/localtime 设置时区为上海 ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 利用date查看 ...

  7. NIO(一)缓冲区

    I/O的基本概念 同步和异步的概念: 所谓的同步就是在发出一个请求的时候,如果没有得到结果,就不返回.即调用者主动等待返回结果. 所谓的异步:调用之后直接返回结果,一般通过回调函数来处理这个应用. 阻 ...

  8. hdu-1272 小希的迷宫---并查集或者DFS

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1272 题目大意: Problem Description 上次Gardon的迷宫城堡小希玩了很久(见 ...

  9. 选中ListBox控件中的全部项

    实现效果: 知识运用: ListBox控件的SelectedItems属性 //获取ListBox控件中被选中数据项的集合 public ListBox.SelectedObjectCollectio ...

  10. python_33_文件操作2

    f=open('yesterday',encoding='utf-8') #print(f.readline())#读一行,并且是第一行 #读前5行 for i in range(5):#range( ...