|  | 
|  | 
| вернуться в форум | WA#13 here is my code Послано Samvel  30 май 2008 00:14can you dive me test for WA#13
 here is the code
 #include<string.h>
 #include<iostream.h>
 main ()
 {
 bool p=true;
 char a[4], b[4], d[4], e[4], t;
 int r1=0, g1=0, b1=0, y1=0, r2=0, g2=0, b2=0, y2=0, kol=0, k=0, c[4]={0,0,0,0}, i, j;
 for (i=0; i<4; i++)
 cin>>a[i];
 for (i=0; i<4; i++)
 cin>>b[i];
 for (i=0; i<4; i++)
 {
 if (a[i]=='R')
 r1++;
 else if (a[i]=='G')
 g1++;
 else if (a[i]=='B')
 b1++;
 else
 y1++;
 if (b[i]=='R')
 r2++;
 else if (b[i]=='G')
 g2++;
 else if (b[i]=='B')
 b2++;
 else
 y2++;
 }
 if (r1!=r2 || g1!=g2 || b1!=b2 || y1!=y2)
 cout<<"different";
 else
 {
 for (i=0; i<4; i++)
 if (a[i]==b[i])
 {
 c[i]=1;
 kol++;
 }
 if (kol>=3)
 cout<<"equal";
 else if (kol==2)
 {
 if (r1>=3 || g1>=3 || b1>=3 || y1>=3)
 cout<<"equal";
 else if (r1==2 || g1==2 || b1==2 || y1==2)
 {
 for (i=0; i<4; i++)
 if (c[i]==1)
 d[k++]=a[i];
 if (d[0]==d[1])
 cout<<"different";
 else
 cout<<"equal";
 }
 else
 cout<<"different";
 }
 else if (kol==1)
 cout<<"equal";
 else
 {
 k=0;
 for (i=0; i<4; i++)
 if (c[i]==0)
 {
 d[k]=a[i];
 e[k++]=b[i];
 }
 for (i=0; i<4; i++)
 {
 t=d[0];
 d[0]=d[3];
 d[3]=d[2];
 d[2]=d[1];
 d[1]=t;
 for (j=0; j<4; j++)
 if (d[j]!=e[j])
 p=false;
 if (p)
 {
 cout<<"equal";
 return 0;
 }
 else
 p=true;
 }
 if (d[1]==e[2] && d[2]==e[1])
 cout<<"equal";
 else if (d[0]==e[3] && d[3]==e[0])
 cout<<"equal";
 else
 cout<<"different";
 }
 }
 return 0;
 }
Re: WA#13 here is my code RBRYRYRB
 
 equal
Re: WA#13 here is my code Послано Samvel  30 май 2008 11:33Thank you, now I've got AC.But test 13 is
 RGBY
 YRGB
 
 different
 | 
 | 
|