编程介的小学生 2019-06-27 21:36 采纳率: 20.5%
浏览 172

立方体的整齐的排列的算法,怎么采用C语言的程序的设计的格式来实现的

Problem Description
Given n cubes 1*1*1 (x, y, z) and n types of pigments . You can choose any one of the n pigments to paint every face of these cubes as you want. To save space, we’d like you to stack these n cubes vertically into a 1*1*n cube. What’s more, to make it as much beautiful as possible, we demand you to find a painting way to make sure that all the vertical faces of the resulting cube are covered by n colors.
For example, such as n = 4, a cube's expand map just as sample 1-1 ;and the stacked cube's expand map just as sample 1-2;

Input
The first line is an integer T (1<=T<=500) indicating the number of test cases.
Each test case begins with an integer n (1<=n<=10), which stands for the number of cubes. Then, the following 3 * n lines each contains a string which only consists of capital letters between 'A' and 'A' + n - 1 (colors of the pigments, 1<=n<=10). Pay attention, each cube occupies 3 lines describing its expanded map.

Output
For each case, print a line formatted as "Case #ID: ", where ID (starting from 1) is the number of current test case. Then, if it’s possible to find a feasible solution, please output "Yes”, or please output "No".

Sample Input
3
2
A
BBAA
B
B
ABBA
A
3
A
ABAB
B
C
AACB
C
C
ABBC
C
4
A
ADCB
A
A
ADBC
D
C
BBAD
C
B
CDAC
D

Sample Output
Case #1: Yes
Case #2: No
Case #3: Yes

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥35 平滑拟合曲线该如何生成
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站