F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Numquam vincar

Time Limit: 9000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 193    Accepted Submission(s): 95


Problem Description
How many string which the length is $n$, has $m$ different nonempty substring, and the character set size is $K$?

Since the answer will be very large, output the answer modulo $10^9+7$.
 

Input
The first line of the input is a integer $T$, meaning that there are $T$ test cases.

Then $T$ lines follow, each contain three integers $n, m, K$ as mentioned above.

$1 \leq T \leq 50,000.$

$1 \leq n \leq 10 ,1 \leq m \leq 100 ,1 \leq K \leq 1,000,000,000.$
 

Output
For every test case output the answer modulo $10^9 + 7$.
 

Sample Input
3 1 1 1 2 3 3 3 5 8
 

Sample Output
1 6 168
 

Hint
For the second sample, "ab,ac,ba,bc,ca,cb" is satisfied.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 19:09:18, Gzip enabled