CF 1790B - Taisia and Dice
Taisia has n six-sided dice. Each face of the die is marked with a number from 1 to 6, each number from 1 to 6 is used once.
Taisia rolls all n dice at the same time and gets a sequence of values a1,a2,…,an (1≤ai≤6), where ai is the value on the upper face of the i-th dice. The sum of this sequence is equal to s.
Suddenly, Taisia's pet cat steals exactly one dice with maximum value ai and calculates the sum of the values on the remaining n?1 dice, which is equal to r.
You only know the number of dice n and the values of s, r. Restore a possible sequence a that fulfills the constraints.
Input
The first line contains the integer t (1≤t≤1000) — the number of testcases.
Each testcase is given on a separate line and contains three integers n, s, r (2≤n≤50, 1≤r<s≤300).
It is guaranteed that a solution exists.
Output
For each testcase, print: n integers a1,a2,…,an in any order. It is guaranteed that such sequence exists.
If there are multiple solutions, print any.
Example
----------------------------------------------
Taisia 有 n 個六面骰子。 骰子的每個面都標有1到6的數(shù)字,1到6的每個數(shù)字只能使用一次。
Taisia 同時擲所有 n 個骰子,得到一系列值 a1,a2,…,an (1≤ai≤6),其中 ai 是第 i 個骰子上表面的值。 該序列的總和等于 s。
突然,泰西亞的寵物貓恰好偷走了一顆具有最大值 ai 的骰子,并計算了剩余 n?1 個骰子的值之和,等于 r。
你只知道骰子的個數(shù)n和s、r的值。 恢復滿足約束的可能序列a。
輸入
第一行包含整數(shù) t (1≤t≤1000) — 測試用例的數(shù)量。
每個測試用例都在單獨的行上給出,并包含三個整數(shù) n、s、r(2≤n≤50、1≤r<s≤300)。
保證存在解。
輸出
對于每個測試用例,打?。簄 個整數(shù) a1,a2,…,an(按任意順序)。 保證這樣的序列存在。
如果有多個解決方案,請打印其中一個。
例子
--------------------------------------------
計算平均值,保留余數(shù),每次都用平均數(shù)+1,然后余數(shù)--,直到余數(shù)為0;
輸出即可;
下面是代碼: