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

String Mod

Time Limit: 11000/5500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 364    Accepted Submission(s): 135


Problem Description
There are strings of length $L$ consisting of the first $k$ $(2\le k\le 26)$ lowercase letters.The total number of strings is $k^L$.

For each pair$(i,j)$($\ 0\leq i,j\leq n-1\ $),please count the number of strings which contain $p$ lowercase letters 'a' and $q$ lowercase letters 'b', satisfying $p \equiv i\ (mod\ n) $ and $ q \equiv j\ (mod\ n) $ .

Print the matrix $A$,$A[i][j]$ is the answer of pair$(i,j)$.
 

Input
The first line contains an integer $T(T \le 10)$. Then $T$ test cases follow.
For each test case the first line contains three integers $k(2\le k\le 26)$,$L(1\le L\le 10
^{18})$,$n(1\le n\le 500)$.
$\sum n\le 2000$.
 

Output
For each test case, output $n$ lines contain $n$ integers.
which is the answer modulo $P=10^9+9$,satisfying $n|(P-1)$.
 

Sample Input
1 2 1 3
 

Sample Output
0 1 0 1 0 0 0 0 0
 

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-04-20 09:38:24, Gzip enabled