Go to movies

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1029    Accepted Submission(s): 543

Problem Description
Winter holiday is coming!As the monitor, LeLe plans to go to the movies.
Because the winter holiday tickets are pretty expensive, LeLe decideds to try group-buying.
 
Input
There are multiple test cases, about 20 cases. The first line of input contains two integers n,m(1≤n,m≤100). n indicates the number of the students. m indicates how many cinemas have offered group-buying.

For the m lines,each line contains two integers ai,bi(1≤ai,bi≤100), indicating the choices of the group buying cinemas offered which means you can use bi yuan to buy ai tickets in this cinema.

 
Output
For each case, please help LeLe **choose a cinema** which costs the least money. Output the total money LeLe should pay.
 
Sample Input
3 2
2 2
3 5
 
Sample Output
4

Hint

LeLe can buy four tickets with four yuan in cinema 1.

 
Source
 
题意:在 m 个电影院选择一家进行团购,团购规则是 b 元买 a 张票,问买 n 张票所需的最少钱?
#include<iostream>
#include<cstdio>
#include<cstring>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long LL;
int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF){
int MIN = ;
for(int i=;i<=m;i++){
int a,b;
scanf("%d%d",&a,&b);
int k = n/a+((n%a==)?:);
MIN = min(MIN,b*k);
}
printf("%d\n",MIN);
}
return ;
}

hdu 5190(水题)的更多相关文章

  1. HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

    N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Subm ...

  2. HDU 5391 水题。

    E - 5 Time Limit:1500MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Statu ...

  3. hdu 1544 水题

    水题 /* * Author : ben */ #include <cstdio> #include <cstdlib> #include <cstring> #i ...

  4. HDU排序水题

    1040水题; These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fa ...

  5. hdu 2710 水题

    题意:判断一些数里有最大因子的数 水题,省赛即将临近,高效的代码风格需要养成,为了简化代码,以后可能会更多的使用宏定义,但是通常也只是快速拿下第一道水题,涨自信.大部分的代码还是普通的形式,实际上能简 ...

  6. Dijkstra算法---HDU 2544 水题(模板)

    /* 对于只会弗洛伊德的我,迪杰斯特拉有点不是很理解,后来发现这主要用于单源最短路,稍稍明白了点,不过还是很菜,这里只是用了邻接矩阵 套模板,对于邻接表暂时还,,,没做题,后续再更新.现将这题贴上,应 ...

  7. hdu 5162(水题)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5162 题解:看了半天以为测试用例写错了.这题玩文字游戏.它问的是当前第i名是原数组中的第几个. #i ...

  8. hdu 3357 水题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3357 #include <cstdio> #include <cmath> # ...

  9. hdu 5038 水题 可是题意坑

    http://acm.hdu.edu.cn/showproblem.php?pid=5038 就是求个众数  这个范围小 所以一个数组存是否存在的状态即可了 可是这句话真恶心  If not all ...

随机推荐

  1. A - 移动的骑士

    A - 移动的骑士 Time Limit: 1000/1000MS (C++/Others) Memory Limit: 65536/65536KB (C++/Others) Problem Desc ...

  2. 【SSH】——hql的使用方式及实现原理

    [含义] hql,即Hibernate Query  Language.它与我们熟知的sql很类似,它最大的特点就是对查询进行了面向对象的封装,下面会在具体例子中说明. sql查询的是数据库中的表或字 ...

  3. 搭建Lepus数据库监控系统

    一.  安装环境 系统环境:centos6.5 IP:192.168.30.242 hostname:vpn.org 软件:LAMP均已安装.(请确保这些正常安装,并能使用). 系统核心包:(摘自官方 ...

  4. oracle补充

    索引 索引是若干数据行的关键字的列表,查询数据时,通过索引中的关键字可以快速定位到要访问的记录所在的数据块,从而大大减少读取数据的I/O次数,因此可以显著的提高性能 创建索引的SQL 把下面表中的na ...

  5. P4467 [SCOI2007]k短路

    题目描述 有 n 个城市和 m 条单向道路,城市编号为 1 到 n .每条道路连接两个不同的城市,且任意两条道路要么起点不同要么终点不同,因此 n 和 m 满足 m \le n(n-1)m≤n(n−1 ...

  6. oracle 导入导出语句

    imp USERID/PSD@SID file='D:\1.dmp' full=y statistics=none exp USERID/PSD@SID file='D:\1.dmp' tables= ...

  7. [Leetcode] Reverse linked list ii 反转链表

    Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given1->2 ...

  8. 【NOIP模拟赛】书 数学+期望概率

    biubiu~~~ 对于这道傻题.........我考场上退了一个多小时才推出来这个东西是排列...........然后我打的dfs效率n!logInf正好n=9是最后一个能过的数结果前三个点的n全是 ...

  9. gogole调试请求体的数据怎么知道

    在network---->header->request payload中看 详细情况见下图所示:

  10. TCP ------ TCP创建服务器中出现的套接字

    在服务器端,socket()返回的套接字用于监听(listen)和接受(accept)客户端的连接请求.这个套接字不能用于与客户端之间发送和接收数据. accept()接受一个客户端的连接请求,并返回 ...