1. 程式人生 > >253 - Cube painting java

253 - Cube painting java

這道題還好,不復雜,uva直接ac,思路:

固定上下2個面(共6種情況),中間4個面按照前左後又的順序排(共4種情況),1個立方體的所有排序種類共4*6=24種,放到ArrayList中.然後看ArrayList中是否包要查的情況,包含輸出TRUE,否則輸出FALSE.

The input of your program is a textfile that ends with the standard end-of-file marker. java裡判斷是否eof結尾,用hasNext


import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    static int[][] arr = {{0,1,2,4,3,5},{1,5,2,0,3,4},{2,1,5,4,0,3},{3,1,0,4,5,2},{4,0,2,5,3,1},{5,4,2,1,3,0}};
    public static void main(String[] args) {
        //輸入資料
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()){
            String str = sc.nextLine();
            //呼叫判斷函式
            isTrue(str);
        }
    }

    private static void isTrue(String str) {
        String str1 = str.substring(0,6);
        String str2 = str.substring(6);
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            get4(list,str1,arr[i]);
        }
        String str3 = str2.substring(0,3)+str2.charAt(4)+str2.charAt(3)+str2.charAt(5);
        if(list.contains(str3)) System.out.println("TRUE");
        else System.out.println("FALSE");
    }

    //上下面固定,獲取中間4種情況
    private static void get4(ArrayList<String> list,String str,int[] arr1){
        int[] arr2 = {arr1[1],arr1[2],arr1[3],arr1[4],};
        for (int i = 0; i < 4; i++) {
            StringBuilder sb = new StringBuilder();
            sb.append(str.charAt(arr1[0]));
            for (int index = 0; index < 4; index++) {
                sb.append(str.charAt(arr2[(index+i)%4]));
            }
            sb.append(str.charAt(arr1[5]));
            list.add(sb.toString());
        }
    }
}
/*
We have a machine for 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 are numbered as in Figure 1.
Since a cube has 6 faces, our machine can paint a face-numbered
cube in 3
6 = 729 different ways. When ignoring the face-numbers,
the number of different paintings is 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 i-th character (1 ≤ i ≤ 6) from the
left gives the color of face i. For example, Figure 2 is a picture of
“rbgggr” and Figure 3 corresponds to “rggbgr”. Notice that both
cubes are painted in the same way: by rotating it around the vertical
axis by 90°, the one changes into the other.
Figure 2 Figure 3
Input
The input of your program is a textfile that ends with the standard end-of-file marker. Each line is a
string of 12 characters. The first 6 characters of this string are the representation of a painted cube, the
remaining 6 characters give you the representation of another cube. Your program determines whether
these two cubes are painted in the same way, that is, whether by any combination of rotations one can
be turned into the other. (Reflections are not allowed.)
Output
The output is a file of boolean. For each line of input, output contains ‘TRUE’ if the second half can be
obtained from the first half by rotation as describes above, ‘FALSE’ otherwise.
Sample Input
rbgggrrggbgr
rrrbbbrrbbbr
rbgrbgrrrrrg
Sample Output
TRUE
FALSE
FALSE

udebug測試資料
E:\develop\Java\jdk1.8\bin\java -javaagent:C:\develop\IntelliJIDEA2017.3.2\lib\idea_rt.jar=8376:C:\develop\IntelliJIDEA2017.3.2\bin -Dfile.encoding=UTF-8 -classpath E:\develop\Java\jdk1.8\jre\lib\charsets.jar;E:\develop\Java\jdk1.8\jre\lib\deploy.jar;E:\develop\Java\jdk1.8\jre\lib\ext\access-bridge-64.jar;E:\develop\Java\jdk1.8\jre\lib\ext\cldrdata.jar;E:\develop\Java\jdk1.8\jre\lib\ext\dnsns.jar;E:\develop\Java\jdk1.8\jre\lib\ext\jaccess.jar;E:\develop\Java\jdk1.8\jre\lib\ext\jfxrt.jar;E:\develop\Java\jdk1.8\jre\lib\ext\localedata.jar;E:\develop\Java\jdk1.8\jre\lib\ext\nashorn.jar;E:\develop\Java\jdk1.8\jre\lib\ext\sunec.jar;E:\develop\Java\jdk1.8\jre\lib\ext\sunjce_provider.jar;E:\develop\Java\jdk1.8\jre\lib\ext\sunmscapi.jar;E:\develop\Java\jdk1.8\jre\lib\ext\sunpkcs11.jar;E:\develop\Java\jdk1.8\jre\lib\ext\zipfs.jar;E:\develop\Java\jdk1.8\jre\lib\javaws.jar;E:\develop\Java\jdk1.8\jre\lib\jce.jar;E:\develop\Java\jdk1.8\jre\lib\jfr.jar;E:\develop\Java\jdk1.8\jre\lib\jfxswt.jar;E:\develop\Java\jdk1.8\jre\lib\jsse.jar;E:\develop\Java\jdk1.8\jre\lib\management-agent.jar;E:\develop\Java\jdk1.8\jre\lib\plugin.jar;E:\develop\Java\jdk1.8\jre\lib\resources.jar;E:\develop\Java\jdk1.8\jre\lib\rt.jar;E:\code\IdeaProjects\dashuju1\out\production\suanfa com.uva.CubePainting
gbgggbgbgbgg
bgbgbbbbgbbg
bbbggrrgbbgb
ggrbgrgbgrrg
ggbgrrgrbrgg
grbrrgrggrbr
gbrbgrbgrgbr
brrrgbrbgbrr
brgggbbggrbg
ggrggrrgggrg
brgbgbbbrggb
bbggrrgrbbrg
rrrrggrgrrgr
grgrbrgrgbrr
rrgggrrrrggg
grrrrrrrrrrg
gggrrbrrgbgg
bbgrbgbrgbgb
rrbrbrbrbrrr
gbgrrrgrrrbg
rbrrbbbrrbrb
rrbrgrrrgrrb
brbbrgbrrbbg
gbrbbrrrgbbb
rbrrrgrbrrgr
bgrrgbggrrbb
rgrrbbrrbbrg
gbbgbrrbbgbg
rbgbbbbrbbgb
rgbgrgrgrgbg
grgrrgggrrrg
rgrgrbrggrrb
rgbgrbgrgrbb
rrrbrgrrrrgb
gggbbbgbggbb
gggbgbggggbb
grbbgbgbrbbg
gbrgggrbgggg
gbrrrgrgbrgr
rbbrrggrbrbr
bgbbgrbgbrgb
ggrggbgrbggg
bbgbgbbbgbgb
rbrrrrrrrrbr
brbrrrrrbbrr
bbgrbgbbrgbg
bgrgbbrgbgbb
gbbgbrbbbrgg
grrgbgbggrgr
rrbrbbbrbrbr
bgbgrgrgggbb
rrbgrgbrrgrg
grrgbrggrrrb
brgbbrrbrgbb
rbgrbbbbrrbg
rrgrgbbggrrr
brbrbrbrrrbb
rgrgbbgrrgbb
rrrrbgrgrrrb
rrbbgrrrbbgr
bbrggggbbggr
bbgbbggbgbbb
bbbg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TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
TRUE
TRUE
TRUE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
TRUE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
TRUE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
FALSE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
TRUE
TRUE
TRUE
FALSE
TRUE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
TRUE
TRUE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
TRUE
FALSE
TRU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