|  | 
|  | 
| вернуться в форум | Easy solution We can just rotate our second diamond and compare it to the first diamond. Like this:for(int i=0;i<4;i++)
 {for(int j=0;j<3;j++)
 {if(a==b)
 {cout<<"equal"<<endl;return 0;}
 // Rotate diamond around current base-face
 string x=e+b[2]+b[3]+b[1];
 b=b[0]+x;}
 string t="abcd";
 // Change base-face
 if(i!=2)
 {t[0]=b[1];t[1]=b[3];
 t[2]=b[2];t[3]=b[0];}
 else
 {t[0]=b[2];t[1]=b[1];
 t[2]=b[3];t[3]=b[0];}
 b=t;}
 | 
 | 
|