Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

请教我的code为什么过不了 有bug还是其他的问题 谢谢大牛进来指教

Posted by yanhaofeng at 2006-10-04 19:33:40 on Problem 3018
#include<stdio.h>
#include<stdlib.h>
#define M 2147483647 
int dist[510][510],box[510][1010] ;
int f(const void *a,const void *b)
{ return *(int *)a-*(int *)b;
}
int main()
{ int i,j,k,m,n,min,flag[510],ff;
  int N,d,gift[1010],x[510];
  while(scanf("%d%d",&N,&d)!=EOF)
  { for(i=1;i<=d;i++)
    { scanf("%d",&gift[i]);
      box[0][i]=gift[i];
    }
    for(i=1;i<=N;i++)
    { for(j=1;j<=d;j++)
      { scanf("%d",&box[i][j]);
      }
    }
    for(i=0;i<=N;i++)qsort(box[i]+1,d,sizeof(int),f); 
    for(i=0;i<=N;i++)
    { for(j=0;j<=N;j++)
      { dist[i][j]=0;
        ff=0;
        for(k=1;k<=d;k++)
        { if(box[i][k]>=box[j][k])
          {ff=1;break;}
        }
        if(ff==0){  dist[i][j]=1;    } 
        
      }
    }
    k=1;x[0]=1;//标记 
    while(1)
    { ff=0;
      for(i=0;i<=N;i++)
      { if(x[i]==k)
        { for(j=0;j<=N;j++)
          { if(dist[i][j]==1)x[j]=k+1; }
          ff=1;
        }
      }
      if(ff==0)break;
      k++;
    }
    k-=2;
    if(k<=0)
    { printf("Please look for another gift shop!\n");
      continue;
    }
    printf("%d\n",k);
  }
}
/*
5 7
4 6 8 2 7 5 3
2 8 13 6 10 9 4
80 70 12 3 6 8 2
8 7 4 6 9 10 12
100 200 300 400 500 600 700
800 800 800 800 800 800 800

6 7
4 6 8 2 7 5 3
900 900 900 900 900 900 900
2 8 13 6 10 9 4
800 800 800 800 800 800 800 
80 70 12 3 6 8 2
8 7 4 6 9 10 12
100 200 300 400 500 600 700

3 7
4 6 8 2 7 5 3
2 8 13 6 10 9 4
80 70 12 3 6 8 2
4 6 8 2 7 5 3



Sample Output                                  


3

*/

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator