暴力美学HDU3650
来源:互联网 发布:yeezy抢鞋软件 编辑:程序博客网 时间:2024/09/21 09:22
原题http://acm.hdu.edu.cn/showproblem.php?pid=3650
Hot Expo
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1272 Accepted Submission(s): 617
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <malloc.h>#include <limits.h>#include <ctype.h>#include <string.h>#include <string>#include <algorithm>#include <iostream>#include <stack>#include <queue>#include <set>#include <map>#include <vector>#include <deque>#include <map>using namespace std;#define N 111struct node{int x;int y;int mark;}a[N];bool cmp(node a,node b){if(a.x == b.x){return a.y < b.y;}return a.x < b.x;}int main(){int n,i,j;while(~scanf("%d",&n)){if(n == 0){break;}for(i=0;i<n;i++){a[i].mark = 1;}for(i=0;i<n;i++){scanf("%d%d",&a[i].x,&a[i].y);}sort(a,a+n,cmp);//int flag = 1;int sum=0;for(i=0;i<n;i++){if(a[i].mark == 1){int flag=i;for(j=0;j<n;j++){if(a[j].x>a[flag].y && j>flag && a[j].mark==1){a[j].mark = 0;flag = j;//a[i].mark = 0;}}a[i].mark = 0;sum++;}}printf("%d\n",sum);}return 0;}
Problem Description
Sunny wants to go to the Shanghai Expo this month and he intends to visit n (1 <= n <= 100 ) country pavilions. As we all know, in each pavilion, there is always a wonderful performance every day. Every performance will always be played only one time each day. And performance i begins at beg[i] second and ends at end[i] second (0<=beg[i], end[i] <24 * 3600). Sunny can not visit more than one country pavilion at the same time. Sunny wouldn't like to miss any performance in the country pavilions that he plans to visit. However, it's also well known that getting accommodation in Shanghai is a little expensive, so he has to make a good arrangement to make his staying time (in days) there minimum.
Input
The input contains several test cases. Each test case begins with an integer number n. Then n lines follow and each contains two integers representing the begin time and end time of the performance in the corresponding day.
Input is terminated by a value of zero (0) for n.
Input is terminated by a value of zero (0) for n.
Output
Output the minimum days that Sunny should spend in visiting in a seperated line for each test case.
Sample Input
21 44 522 34 60
Sample Output
2 1
0 0
- 暴力美学HDU3650
- LeetCode:strStr 暴力美学
- 中国母亲的暴力美学
- POJ 2531 Network Saboteur(暴力美学)
- hdu 5762 Teacher Bo(暴力美学)
- 搜狗输入法白盒测试的“暴力与美学”
- 想学微信的界面设计,来看看WeUI的暴力美学
- HDU3650 Hot Expo
- 关于美学!
- 传统美学
- 设计美学
- 征服世界的美学暴力:「电影级」幻灯片设计方法论(含U盘1个)——互动出版网
- 程序设计中的美学
- 茶道美学概要
- 珠宝 玩味几何美学
- 成功不需要美学
- 美学和音乐
- Auto Layout 设计美学
- 当前日期(Date类)
- http://write.blog.csdn.net/postedit
- KGTP中增加对GDB命令“set trace-buffer-size”的支持 - Week 3
- java hough变换(霍夫变换)检测直线
- 自动评论CSDN下载资源(httpclient)
- 暴力美学HDU3650
- java面向对象-final关键字
- JAVA帮助文档全系列 JDK1.5 JDK1.6 JDK1.7 官方中英完整版下载
- Delphi 常用控件之TlistView总结
- jQuery_review 之 通过.load()方法来实现异步加载HTML文档
- 线段树,最大最小值
- java面向对象-抽象类abstract
- 2014杭电多校联合第一场Task(贪心+STL使用)
- NT4源码编译环境