Uva253cube Painting Dice Coloring

Source: Internet
Author: User

We have a painting cubes. It is supplied with three different colors:blue, red and green. Each face of the cube gets one of these colors. The cube ' s faces is numbered as in Figure 1.

Figure 1.

Since a cube has 6 faces, we can paint a face-numbered cube in different ways. When ignoring the face-numbers, the number of different paintings was much less, because a-cube can be rotated. See example below. We denote a painted cube by a string of 6 characters, where each character is a b, R, or g. The character () from the left gives the color of face i. For example, Figure 2 was a picture of Rbgggr and Figure 3 corresponds to rggbgr. Notice that both cubes is painted in the same way:by rotating it around the vertical axis by a, the one changes into The other.

Input

The input of your program was a textfile that ends with the standard end-of-file marker. Each line is a string of characters. The first 6 characters of this string is the representation of a painted cube, the remaining 6 characters give you the RE Presentation of another cube. Your program determines whether these-cubes is painted on the same, that's, whether by any combination of Rotati ONS one can be turned to the other. (Reflections is not allowed.)

Output

The output is a file of Boolean. For each line of input, output contains TRUE if the second half can is obtained from the first half by rotation a S describes above, FALSE otherwise.

Sample Input

Rbgggrrggbgrrrrbbbrrbbbrrbgrbgrrrrrg

Sample Output

TRUE

FALSE

FALSE

Enter a dice to determine whether it is equivalent.

1#include <iostream>2 3 using namespacestd;4            //list 4*6 species may5 inta[ -][6] =6 { {},7{1,2,3,4,5,6}, {1,4,2,5,3,6}, {1,5,4,3,2,6}, {1,3,5,2,4,6 },8{6,2,4,3,5,1}, {6,3,2,5,4,1}, {6,5,3,4,2,1}, {6,4,5,2,3,1 },9{2,6,3,4,1,5}, {2,4,6,1,3,5}, {2,1,4,3,6,5}, {2,3,1,6,4,5 },Ten{5,6,4,3,1,2}, {5,3,6,1,4,2}, {5,1,3,4,6,2}, {5,4,1,6,3,2 }, One{3,2,6,1,5,4}, {3,1,2,5,6,4}, {3,5,1,6,2,4}, {3,6,5,2,1,4 }, A{4,2,1,6,5,3}, {4,6,2,5,1,3}, {4,5,6,1,2,3}, {4,1,5,2,6,3 } - }; -  the intMain () - { -     intI, J, N, M, S, T; -     Chars1[ -], s2[ -]; +      while(CIN&GT;&GT;S1)//Input string S1 total 12 bits -     { +          for(i =6; I <= A; i++)//Assign the latter six bits to S2 A         { atS2[i-6] =S1[i]; -         } -          for(i =1; I <= -; i++) -         { -              for(j =0; J <=5; J + +) -             { in                  -                 if(S2[j] = = S1[a[i][j]-1]) to                 { +  -                 } the                  *                 Else $                 {Panax Notoginseng                      Break;//If it is not one by one, exit the current loop (the nearest for loop)
-}//and I+1 continues to circulate .
the} + if(J = =6)//j==6 shows that this cycle J runs more than six times, and there are one by one correspondence. A { the Break; Exit Loop + } - } $ if(i = = -)//i==25 Description loop more than 24 times, no one by one corresponding entries found, False $ { -printf"false\n"); - } the Else - {Wuyiprintf"true\n"); the } - } Wu return 0; -}



















Uva253cube Painting Dice Coloring

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.