|
|
back to boardWhat's wrong on this program?? Posted by ijk 23 Mar 2002 05:42 #include<iostream.h> int N, A; int where[1001]; int start[1001]; int *y; short line[1001]; int hows; void main() { int i, j; y = new int[32000]; cin>>N>>A; for (i=1; i<=N; i++) where[i] = 0; hows=0; for (i=1; i<=N; i++) { for (j=1; j<=N; j++) cin>>line[j]; for (j=i%N+1; j!=i; j=j%N+1) if (line[j]==0) { where[i]++; y[hows]=j; hows++; } } start[1]=0; for (i=2; i<=N; i++) start[i]=where[i-1]+start[i-1]; i = A; j = y[start[i]]; while (hows>0) { start[i]++; cout<<i<<" "<<j<<endl; hows--; i = j; j = y[start[i]]; } delete[] y; } |
|
|