help in coloring problem.

Revision en1, by bhayanak, 2017-09-04 12:29:41

How to solve this simple problem?

You are given a tree of N vertices, and an integer K. How many ways are there to colour the tree with K colours such that no edge is adjacent to vertices of the same colour.

Since the answer may be large, output the answer modulo 1,000,000,007.

Please explain how did u arrive at the result?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English bhayanak 2017-09-04 12:29:41 359 Initial revision (published)