Q1892.(10分数, 语言: C)Two Bags of Potatoes time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output 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. Input The first line of input contains three integers y, k, n (1≤y,k,n≤10^9; n/k≤10^5). Output 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.
中文翻译:
题目描述
瓦莱拉有两个装满土豆的袋子。第一个袋子里有x(x≥1)个土豆,第二个袋子里有y(y≥1)个土豆。瓦莱拉是一个非常粗心大意的男孩,所以他丢失了第一个袋子(里面装有x个土豆)。
瓦莱拉记得,这两个袋子里的土豆总数(x+y)首先不会超过n,其次这个总数能被k整除。
请帮助瓦莱拉确定第一个袋子里可能有多少个土豆。按照升序打印出所有可能的数字。
输入
输入的第一行包含三个整数y, k, n(1≤y,k,n≤10^9;n/k≤10^5)。
输出
打印一个由空格分隔的整数列表——所有可能的x值,按照升序排列。每个可能的x值应该只打印一次。如果没有这样的x值,打印单个整数-1。
题目分析


2万+

被折叠的 条评论
为什么被折叠?



