|
|||
The Triangle Game
In the triangle game, you start off with six triangles numbered on each edge, as in the example above. You can slide and rotate the triangles so they form a hexagon, but the hexagon is only legal if edges common to two triangles have the same number on them. You may not flip any triangle over. Two legal hexagons formed from the six triangles are illustrated below:
The score for a legal hexagon is the sum of the numbers on the outside six edges. Your problem is to find the highest score that can be achieved with any six particular triangles. Input SpecificationThe input will contain one or more test cases. Each test case is a sequence of six lines with three integers from 1 to 100, separated by blanks on each line. Each line contains the numbers on the triangles in clockwise order. Test cases are separated by a line containing only an asterisk. The last test case is followed by a line containing only a dollar sign. Output Specification
For each test case, the output is a line containing only the word
“ Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |