301275: CF239A. Two Bags of Potatoes

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Two Bags of Potatoes

题意翻译

一个小朋友有两袋土豆 $x, y$($x, y \ge 1$)且两袋土豆总和 $\le n$ 且总和能被 $k$ 整除。给出 $y, k, n$,求所有可能的 $x$。如果没有这样的 $x$ 值,输出 `-1`;否则,一行不重复地输出所有可能的 $x$ 值,两两之间用一个空格隔开,并按照升序排列。

题目描述

Valera had two bags of potatoes, the first of these bags contains $ x $ $ (x>=1) $ potatoes, and the second — $ y $ $ (y>=1) $ potatoes. Valera — very scattered boy, so the first bag of potatoes (it contains $ x $ potatoes) Valera lost. Valera remembers that the total amount of potatoes $ (x+y) $ in the two bags, firstly, was not gerater than $ n $ , and, secondly, was divisible by $ k $ . Help Valera to determine how many potatoes could be in the first bag. Print all such possible numbers in ascending order.

输入输出格式

输入格式


The first line of input contains three integers $ y $ , $ k $ , $ n $ ( $ 1<=y,k,n<=10^{9}; $ ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF239A/53488bbee46df1b241cbadadd932aea80891152b.png) $ <=10^{5} $ ).

输出格式


Print the list of whitespace-separated integers — all possible values of $ x $ in ascending order. You should print each possible value of $ x $ exactly once. If there are no such values of $ x $ print a single integer -1.

输入输出样例

输入样例 #1

10 1 10

输出样例 #1

-1

输入样例 #2

10 6 40

输出样例 #2

2 8 14 20 26 

Input

题意翻译

一个小朋友有两袋土豆 $x, y$($x, y \ge 1$)且两袋土豆总和 $\le n$ 且总和能被 $k$ 整除。给出 $y, k, n$,求所有可能的 $x$。如果没有这样的 $x$ 值,输出 `-1`;否则,一行不重复地输出所有可能的 $x$ 值,两两之间用一个空格隔开,并按照升序排列。

加入题单

算法标签: