Pro.ID10192 TitleFrame Up Title链接http://10.20.2.8/oj/exercise/problem?problem_id=10192 AC2 Submit15 Ratio13.33% 时间&空间限制描述Consider the following five picture frames shown on an 9 × 8 array: ........ ........ ........ ........ .CCC.... Now place all five picture frames on top of one another starting with 1 at the bottom and ending up with 5 on top. If any part of a frame covers another frame, it hides that part of the frame below. Viewing the stack of five frames we see the following. .CCC.... Given a picture like this, determine the order of the frames stacked from bottom to top. Here are the rules for this challenge:
输入Multiple test cases. For each case , Line 1: Two space-separated integers: the height H (3 ≤ H ≤ 30) and the width W (3 ≤ W ≤ 30). Line 2..H+1: H lines, each with a string W characters wide. 输出Description Consider the following five picture frames shown on an 9 × 8 array: ........ ........ ........ ........ .CCC.... Now place all five picture frames on top of one another starting with 1 at the bottom and ending up with 5 on top. If any part of a frame covers another frame, it hides that part of the frame below. Viewing the stack of five frames we see the following. .CCC.... Given a picture like this, determine the order of the frames stacked from bottom to top. Here are the rules for this challenge:
Input Multiple test cases. For each case , Line 1: Two space-separated integers: the height H (3 ≤ H ≤ 30) and the width W (3 ≤ W ≤ 30). Line 2..H+1: H lines, each with a string W characters wide. Output For each case, print the letters of the frames in the order they were stacked from bottom to top. If there are multiple possibilities for an ordering, list all such possibilities --- in alphabetical order --- on successive lines. There will always be at least one legal ordering. Output a blank line after case. Sample Input 9 8 Sample Output EDABC Source 样例输入9 8 样例输出EDABC 作者 |