ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1433. Diamonds

Easy solution
Posted by adamant 27 Jan 2014 19:30
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;}