hdu 5190 Go to movies(水)
来源:互联网 发布:centos 网络配置 dhcp 编辑:程序博客网 时间:2024/04/28 14:47
Go to movies
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1028 Accepted Submission(s): 542
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.
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 them 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.
For the
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 22 23 5
Sample Output
4HintLeLe can buy four tickets with four yuan in cinema 1.
问你哪个电影院可以话最少元买到n个学生的票,输出价钱
思路:水题,直接模拟
代码:
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>using namespace std;#define INF 999999999int main(){ int n,m; int a,b; while(~scanf("%d %d",&n,&m)) { int ans=INF; for(int i=1;i<=m;i++) { scanf("%d %d",&a,&b); int cost=n/a; if(n%a!=0) cost++; ans=min(ans,cost*b); } printf("%d\n",ans); } return 0;}
’
0 0
- hdu 5190 Go to movies(水)
- HDU 5190-Go to movies
- hdu 5190 Go to movies
- HDU-5190-Go to movies
- HDU - 5190 - Go to movies && 5191 - Building Blocks (BC#34 A,B)
- 【CUGBACM14级BC第34场 A】hdu 5190 Go to movies
- HDU 5193 Go to movies Ⅱ(块状数组套树状数组)
- HDU 5193 Go to movies Ⅱ 块状链表套树状数组
- 【Best Coder】Go to movies
- BC 34# 1001 Go to movies
- BestCoder Round #34 1001 Go to movies
- hdu 5193 Go to movies Ⅱ 块状链表 + 树状数组
- Hdu 5193 Go to movies Ⅱ(带删除数插入数的逆序数对,块状链表)
- HDU 5193 Go to movies Ⅱ 块状链表套树状数组(带插入和删除的逆序对)
- Movies to watch
- Americans Prefer Games to Movies
- hdu 1372 Knight Movies(bfs)
- movies
- [Unity3D]AR应用中,关于东南西北方位的判断。
- PAT (Top Level) Practise 1008 Airline Routes (35) (tarjan算法求强联通分量)【四星级】
- HDU 2199 Can you solve this equation?(二分)
- c指针解析
- Matlab学习日记-1
- hdu 5190 Go to movies(水)
- 访问受保护的属性
- 正则表达式规则及C语言测试代码
- 为什么匿名内部类参数必须为final类型
- epoll与selectpoll的区别!!!
- Servlet文件上传和下载---个人相册
- Centos 6.5下编译安装php5.6
- 图片轮播(方法学习记忆)
- POJ 1318 字典排序