CF1864A.Increasing and Decreasing
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given three integers x , y , and n .
Your task is to construct an array a consisting of n integers which satisfies the following conditions:
- a1=x , an=y ;
- a is strictly increasing (i.e. a1<a2<…<an );
- if we denote bi=ai+1−ai for 1≤i≤n−1 , then b is strictly decreasing (i.e. b1>b2>…>bn−1 ).
If there is no such array a , print a single integer −1 .
输入格式
Each test contains multiple test cases. The first line contains the number of test cases t ( 1≤t≤1000 ). The description of the test cases follows.
The only line of each test case contains three integers x , y , n ( 1≤x<y≤1000,3≤n≤1000 ).
输出格式
For each test case, output n integers a1,a2,…,an . If there are multiple solutions, print any of them.
If there is no solution, print a single integer −1 .
输入输出样例
输入#1
3 1 4 3 1 3 3 100 200 4
输出#1
1 3 4 -1 100 150 180 200
说明/提示
In the first test case, a=[1,3,4] , which is strictly increasing. Next, b1=a2−a1=3−1=2 , b2=a3−a2=4−3=1 , thus b=[2,1] , which is strictly decreasing.
In the second test case, there is no array a that satisfies all the conditions above.