MZL's game

Time Limit: 3000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5346
64-bit integer IO format: %I64d      Java class name: Main

Description

MZL has $n$ cute boys.They are playing a game♂.The game will run in turn
First,System choose an alive player $x$ randomly.Player $x$ will be out of the game.
Then player x will attack all alive players in the game
When a player is attacked,$1-p$ is the probability of he still lives,$p$ is the probability of he dies
Now mzl wants to know:the probability of one player be out of the game and be attacked $k$ times

You need to print the probability mod 258280327 for every k from 0 to n-1

According to Fermat Theory,$\frac{x}{y}$ mod 258280327=x*$(y^{258280325})$ mod 258280327

$p$ will be given in a special way

Input

The first line of the input contains a single number $T$, the number of test cases.
Next $T$ lines, each line contains three integer $n$,$x$,$y$.$p=\frac{x}{y}$
$T\leq 5$, $n\leq 2*10^3$ $0 \leq x \leq 10^9$ $x+1 \leq y \leq 10^9$.
It is guaranteed that y and 258280327 are coprime.

Output

$T$ lines, every line n numbers: the ans from 0 to n-1

Sample Input

2
3 33 100
9 23 233

Sample Output

172186885 210128265 223268793
229582513 70878931 75916746 175250440 21435537 57513225 236405985 111165243 115953819

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .