ZOJ Problem Set - 1486
Given a tree with n nodes (which are represented by numbers from 1 to n) and m colors. How many different ways are there to color the nodes so that none of two neighboring nodes have the same color?
There are several test cases.
For each test case print in a single line the number of different coloring ways.
Author: DU, Peng
Source: ZOJ Monthly, February 2003