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. idea tomcat 启动报错 org.apache.catalina.core.StandardService.initInternal Failed to initialize connector

    org.apache.catalina.core.StandardService.initInternal Failed to initialize connector org.apache.cata ...

  2. JavaScript constructor 属性详解

    对象的constructor属性用于返回创建该对象的函数,也就是我们常说的构造函数. 在JavaScript中,每个具有原型的对象都会自动获得constructor属性.除了arguments.Enu ...

  3. iOS-数据持久化之Sqllite

    iOS中的数据存储方式 Plist(NSArray\NSDictionary) Preference(偏好设置\NSUserDefaults) NSCoding(NSKeyedArchiver\NSk ...

  4. 【bzoj4002】[JLOI2015]有意义的字符串 数论+矩阵乘法

    题目描述 B 君有两个好朋友,他们叫宁宁和冉冉.有一天,冉冉遇到了一个有趣的题目:输入 b;d;n,求 输入 一行三个整数 b;d;n 输出 一行一个数表示模 7528443412579576937 ...

  5. 周记【距gdoi:96天】

    倒计时从三位数变成了两位数. 然后这周还是很不知道怎么说,经常写一道题写两天.但是总算把后缀数组写完了,也整理完了. 然后周末都不知道干了什么周末就过去了.无聊看了两道省选题发现都是不会做系列,看了以 ...

  6. MFC Button控件自绘

    文章参考地址:  http://blog.csdn.net/yue7603835/article/details/6649458    VC下的界面着实难看 有时候我们不得不自己进行控件的绘制 以前 ...

  7. [Leetcode] Merge k sorted lists 合并k个已排序的链表

    Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 思 ...

  8. 【HDU 4300 Clairewd’s message】

    Clairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important ...

  9. BZOJ day8

    好吧,, 补一天题解. 1001  狼抓兔子 妥妥的网络流啊,难度仅次于草地排水,边都给出来了.就是注意反向边也要有流量就行. 1007 水平可见直线 这个题按斜率排序(注意不是绝对值),然后将直线入 ...

  10. codeforces 1015E1&&E2

    E1. Stars Drawing (Easy Edition) time limit per test 3 seconds memory limit per test 256 megabytes i ...