ZOJ Problem Set - 2058
Lazy Genius, a Archaelogist, recently found a lot of ancient steles, on which
there are only two kinds of characters, '*'and '@'. The characters formed a
equilateral triangle on each steles. The triangle has N lines.The ith line contain
* * @ * @ * @ * @ *
Through hard researchs, he found some rules of arrange of characters. There are only 4 styles of arranges of any three adjacent characters:
* @ @ * * @, @ *, * @, @ *
Through hundreds of thousands of years, most of steles have become hard to identify. With the rules above, Mr.Genius recovered many steles. However, there are too many steles to be recovered by hand. Now Mr.Genius turns to you, a gifted programming student. He believes that you could help him.
Your task is to find out the maximum number and the minimum number of '@' of a given stele.
output a line contain two integers for each test block, the maximum and the minimum.
Author: LIN, Zi
Source: ZOJ Monthly, December 2003