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. Ubuntu 14.04上安装Riak

    一.安装riak   1. 安装包:riak_2.0.2-1_amd64.deb    路    径:~/software/riak_2.0.2-1_amd64.deb 2. 安装riak     $ ...

  2. springBoot学习 错误记录

    1.下面结果 会出现500错误 原因:thymeleaf相关包版本不兼容导致 解决:之前配置的3.0.9对应2.1.1&2.2.2,3.0.6对应2.2.2&2.1.1都不可以,下面的 ...

  3. 从零开始的全栈工程师——js篇2.13(字符串与数组的方法)

    基类Object的子类有 Function  Array  Number  Boolean  String  Date  Math  RegExp 函数 数组 数字 布尔 字符串 日期 算数 正则 都 ...

  4. bootstrapValidator 如何重新启用提交按钮

    bootstrapValidator 使用中,由于字段检查等原因,致使提交按钮失效.如何重新启用提交按钮呢? 下面一句代码可以实现启用提交按钮: $('#loginForm').bootstrapVa ...

  5. Eucalyptus-NC管理

    1.前言 Elastic Utility Computing Architecture for Linking Your Programs To Useful Systems (Eucalyptus) ...

  6. 跨平台移动开发phonegap/cordova 3.3全系列教程-目录

    目录(更新完成后会附上源码供参考) 第一章 android平台开发 phonegap/cordova简介 1.开发环境搭建 2.helloworld 3.启动画面 4.结合asp.net/jqmboi ...

  7. COGS 1453. [USACO NOV]空牛栏

    ★★   输入文件:empty.in   输出文件:empty.out   简单对比时间限制:1 s   内存限制:64 MB [题目描述] FJ建的新牛棚里有N(2<=N<=3,000, ...

  8. tp3.2.3自定义全局函数的使用

    全局函数的定义,好处就是我们可以跨文件使用,而且调用方式可以直接调用,十分方便,在这里做个小记录 1.在Application/Home/Common目录下面新建一个名为function.php的文件 ...

  9. windows 10 开启安卓模拟器蓝屏

    上周装了个vs2017 rc 本想试试 开发安卓怎么样,花了一晚上时间终于装好了. 第二天开夜神模拟器的时候蓝屏了.. 然后就逐个卸载VS2017的功能,先是卸了 自带的仿真程序,没用.然后全部卸载掉 ...

  10. hangfire使用

    1 . NuGet 命令行执行 Install-Package Hangfire2.首先在ConfigureServices 方法中注册服务: services.AddHangfire(r=>r ...