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. lock关键字的使用

    最近在代码中,发现别人使用了lock关键字,为了理解别人写的代码,所以自己对lock关键字的使用研究了下. 微软官方解释,请百度:lock 语句(C# 参考) 微软给了个官网实例代码: class A ...

  2. systemPath

    <dependency>   <groupId>com.aliyun.mns</groupId>   <artifactId>aliyun-sdk-mn ...

  3. el-checkbox根据是否被选中执行不同的操作

    直接给el-checkbox绑定点击事件是没有效果的,因为它会被解析成其他形式的html,el-checkbox只是一个类名,因此,使用ts和jquery动态绑定事件: mounted() { $(& ...

  4. Map.Entry遍历Map

    Map.entry是Java中的一个接口.每一个Map.entry代表一个map对象. 可以通过 Map是java中的接口,Map.Entry是Map的一个内部接口,它表示map中的一个实体(及一个k ...

  5. SpringBoot 入门学习(HelloWord)

    前置知识 1.会利用 maven 构建项目 2.了解 Spring 注解 3.了解 RESTful API 的基本理论 4.SpringBoot 是 SpringMVC 的升级版,但两者没有必然的联系 ...

  6. Hibernate关联映射之_多对一

    多对一 Employee-Department 对于 员工 和 部门 两个对象,从员工的角度来看,就是多对一的一个关系--->多个员工对应一个部门 表设计: 部门表:department,id主 ...

  7. group by 分组后 返回的是一个同属性的集合

    group by 分组后 返回的是一个同属性的集合  我们可以遍历该集合

  8. BZOJ4651 NOI2016网格(割点)

    首先显然可以通过孤立角落里的跳蚤使其不连通,所以只要有解答案就不会大于2.同样显然的一点是当且仅当跳蚤数量<=2且连通时无解.做法其实也很显然了:特判无解,若跳蚤不连通输出0,否则看图中是否无割 ...

  9. [Leetcode] word break ii拆分词语

    Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each ...

  10. 【BZOJ 2744 朋友圈】

    Time Limit: 30 Sec  Memory Limit: 128 MBSubmit: 1570  Solved: 532[Submit][Status][Discuss] Descripti ...