讨论 / 我哪错了???
newHZD 2010-08-05 21:56:00
点我顶贴 收藏 删除
#include<stdio.h>

#include<stdlib.h>

#define N 5001

int i,j,k;

int a[N],b[N],c[N];

int comp_int(const void*a,const void *b)

{

return *(int *)a-*(int *)b;

}

void init()

{

i=1,j=1;

int n,m,s;

int sum,sun;

scanf("%d %d\n",&n,&m);

for(i=1;i<=n;i++)

{

scanf("%d %d\n",&a[i],&b[i]);

}

sun=m*15/10;

for(i=1;i<=n;i++)

{

c[i]=b[i];

}

qsort(c,n,sizeof(int),comp_int);

for(i=sum;i<=n;i++)

{ if(*(c+sum)==*(c+sum++))

sum++;

else

break;

}

i=1;

while(j<=n)

{

if(j>n)

break;

if(*(b+j)==*(c+i))

*(c+n+i)=a[j];

else

i++;

if(i==n) j++;

}

printf("%d %d\n",*(c+sum),sum);

for(i=n+1;i<=sum+n;i++)

{

printf("%d %d\n",*(c+n+i),*(c+i));

}

}

int main()

{

//freopen("score.in","r",stdin);

//freopen("score.out","w",stdout);

init();

while(1);

return 0;

}

#1 newHZD@2010-08-05 21:56:00
回复 删除
i know
查看更多回复
提交回复