Time Limit: 1s
Memory Limit: 512MB
A k-path on a given undirected graph is a path having exactly k edges and containing no repeated nodes. Given an undirected graph G and an integral value k, count how many k-paths on G.
The input consists of following lines:
Line 1: contains two integer n and k (1 ≤ n≤ 30, 1 ≤ k ≤ 10) in which n is the number of nodes of the graph G (nodes are numbered 1,2,...,n);
Line 2: contains an integer m (1 ≤ m ≤ 60) which is the number of edges of G;
Line i+2: contains two integers u and v representing two end points of the ith edge of G (i = 1,2,...,m).
The output contains the number of k-paths of G.
4 3 5 1 2 1 3 1 4 2 3 3 4
6