|
|
вернуться в форумWA =( show me my mistakes, please! Послано CExFX 21 авг 2007 19:27 I have WA and I don't know why. All tests I've done gave me right answers. Somebody, please help me, show me my mistakes!!! Text of program(С++): #include <iostream.h> void main() { short M,N; int j; cout<<"Enter amounts of colors and pieces\n"; cin>>M>>N; cout<<"\nEnter all pieces\n"; short a[500][50]; for (int i=0; i<M; i++) for ( j=0; j<N; j++) cin>>a[i][j]; short t,z,u=0,kolvo=0,p=0,q=0; do { for ( i=0; i<M; i++) for ( j=0; j<N; j++) if(a[i][j]!=(i+1)) { p=j; q=i; if(u==0) t=a[i][j]; else { z=a[i][j]; a[i][j]=t; t=z; } kolvo++;
for (int k=0; k<N; k++) if (a[t-1][k]!=t) { z=a[t-1][k]; a[t-1][k]=t; t=z; u=1; kolvo++; } if (N==1)i=t-2; else i=t-1; j=0;
} }while((i<M)&&(j<N)); if(u==1) kolvo--; cout<<"\nAnswer is="<<kolvo; } Re: WA =( show me my mistakes, please! You haven't to write some code like cout<<"Enter amounts of colors and pieces\n"; and read FAQ before using Online Judge Still WA Послано CExFX 21 авг 2007 22:36 Thank you, but sill WA on 6th test. =( Re: Still WA Try to change short into int>Maybe then you'll get AC. Re: Still WA Послано CExFX 22 авг 2007 03:10 I've already tried to do as you say,but still WA. |
|
|