南阳 966 选择不相交区间
来源:互联网 发布:centos7 源码安装php 编辑:程序博客网 时间:2024/06/05 14:48
#include<stdio.h>#include<string.h>#include<stdlib.h>typedef struct In{int x,y;};In num[1010];int cmp(const void *a,const void *b){In *c=(In *)a;In *d=(In *)b;if(c->y!=d->y) return c->y-d->y; }int main(){int n,m=1,i,j,s;int a,b,t;while(~scanf("%d",&n)){memset(num,0,sizeof(num));for(i=0;i<n;i++){scanf("%d%d",&a,&b);if(a>b){t=a;a=b;b=t;}num[i].x=a;num[i].y=b;}qsort(num,n,sizeof(num[0]),cmp);int max=num[0].y;for(s=i=1;i<n;i++){if(num[i].x>max){s++;max=num[i].y;}}printf("Case %d:\n",m++);printf("%d.\n",s);}return 0;}
0 0
- 南阳 966 选择不相交区间
- 南阳理工966 选择不相交区间
- 选择不相交区间
- 选择不相交区间
- 选择不相交区间
- 选择不相交区间
- nyoj-966-选择不相交区间
- nyoj 966 选择不相交区间
- 0j 966 选择不相交区间
- 选择不相交区间【贪心】
- 选择不相交区间 小结
- NYOJ_996_选择不相交区间
- 南阳168房间安排(最多不相交区间问题)
- 选择不相交区间(贪心)
- 8.4.4(选择不相交的区间)
- 选择尽可能多的不相交区间
- 贪心法 1230选择不相交区间
- 选择不相交区间-java实现
- android ViewPager详解
- "0x00a1bdb3" 指令引用的 "0x00000001" 内存。该内存不能为 "read"。
- springMVC3学习(八)--全局的异常处理
- uva 11270 插头DP
- SP2-0618、SP2-0611 PLUSTRCE授权错误
- 南阳 966 选择不相交区间
- PHP解决URL中文GBK乱码问题
- IP分片原理及分析
- httpRequest与httpwebrequest区别
- 张静初挺黄海波:他口无遮拦得罪不少人
- 分水岭图像分割算法
- hello.c
- JavaScript绑定事件时的闭包问题
- ASP.NET MVC4全局过滤器