nyoj-236-心急的C小加
来源:互联网 发布:手机照片墙软件 编辑:程序博客网 时间:2024/06/10 16:31
#include<stdio.h>
#include<stdlib.h>
struct mubang
{
int x;
int y;
}a[5005];
int cmp(const void *a,const void *b)
{
struct mubang *c=(struct mubang *)a;
struct mubang *d=(struct mubang *)b;
if(c->x!=d->x)
return c->x-d->x;
else
return c->y-d->y;
}
int main()
{
int s;
scanf("%d",&s);
while(s--)
{
int n,i,j,k=0,b[5005]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d%d",&a[i].x,&a[i].y);
qsort(a,n,sizeof(a[0]),cmp);
for(i=0;i<n;i++)
for(j=0;j<i;j++)
if(!b[j]&&a[i].x>=a[j].x&&a[i].y>=a[j].y)
{
a[j].x=a[i].x;
a[j].y=a[i].y;
b[i]=1;
break;
}
for(i=0;i<n;i++)
if(!b[i])
k++;
printf("%d\n",k);
}
return 0;
}
#include<stdlib.h>
struct mubang
{
int x;
int y;
}a[5005];
int cmp(const void *a,const void *b)
{
struct mubang *c=(struct mubang *)a;
struct mubang *d=(struct mubang *)b;
if(c->x!=d->x)
return c->x-d->x;
else
return c->y-d->y;
}
int main()
{
int s;
scanf("%d",&s);
while(s--)
{
int n,i,j,k=0,b[5005]={0};
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d%d",&a[i].x,&a[i].y);
qsort(a,n,sizeof(a[0]),cmp);
for(i=0;i<n;i++)
for(j=0;j<i;j++)
if(!b[j]&&a[i].x>=a[j].x&&a[i].y>=a[j].y)
{
a[j].x=a[i].x;
a[j].y=a[i].y;
b[i]=1;
break;
}
for(i=0;i<n;i++)
if(!b[i])
k++;
printf("%d\n",k);
}
return 0;
}
- NYOJ 236 心急的C小加
- nyoj 236 心急的C小加
- NYOJ-236:心急的C小加
- NYOJ 236心急的C小加
- nyoj 236 心急的c小加
- nyoj-236-心急的C小加
- 【NYOJ 236 心急的C小加】
- NYOJ 236 心急的C小加
- NYOJ 236 心急的C小加
- NYOJ 236 心急的C小加
- NYOJ 236 心急的C小加
- nyoj 236心急的C小加
- NYOJ 236 心急的C小加
- nyoj 236 心急的C小加
- nyoj-236心急的C小加
- NYOJ 236 心急的c小加
- nyoj 236 心急的C小加
- nyoj 236 心急的C小加
- 判断闰年
- 任务1——猜数字游戏
- 等概率随机函数和任意概率随机函数
- 联想F31,老机换新颜--Win8.1安装手记
- Replication on redis
- nyoj-236-心急的C小加
- u-boot源码分析
- Java获取客户端IP地址
- 十一周——星号图(2)
- hdu 1002 A + B Problem II(java)
- C文件操作函数
- 十一周——星号图(3)
- Hadoop MapReduce之MapTask任务执行(三)
- JAVA学习.JAVA历史和机制以及一些规则