303977: CF765C. Table Tennis Game 2

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Table Tennis Game 2

题意翻译

米莎和瓦尼亚打乒乓球。每盘由几次发球组成,每一次发球都由一名队员赢得,他得一分,输的一分也得不到。一旦其中一个玩家刚好获得K分,该分数将被重置,并开始新的一局。 在所有的比赛中,米莎总分A分,瓦尼亚总分B分。根据这些信息,确定他们比赛的最多局数,或者情况是不可能发生的。 请注意,每一局都是完整的一局

题目描述

Misha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the players, he receives one point and the loser receives nothing. Once one of the players scores exactly $ k $ points, the score is reset and a new set begins. Across all the sets Misha scored $ a $ points in total, and Vanya scored $ b $ points. Given this information, determine the maximum number of sets they could have played, or that the situation is impossible. Note that the game consisted of several complete sets.

输入输出格式

输入格式


The first line contains three space-separated integers $ k $ , $ a $ and $ b $ ( $ 1<=k<=10^{9} $ , $ 0<=a,b<=10^{9} $ , $ a+b&gt;0 $ ).

输出格式


If the situation is impossible, print a single number -1. Otherwise, print the maximum possible number of sets.

输入输出样例

输入样例 #1

11 11 5

输出样例 #1

1

输入样例 #2

11 2 3

输出样例 #2

-1

说明

Note that the rules of the game in this problem differ from the real table tennis game, for example, the rule of "balance" (the winning player has to be at least two points ahead to win a set) has no power within the present problem.

Input

题意翻译

米莎和瓦尼亚打乒乓球。每盘由几次发球组成,每一次发球都由一名队员赢得,他得一分,输的一分也得不到。一旦其中一个玩家刚好获得K分,该分数将被重置,并开始新的一局。 在所有的比赛中,米莎总分A分,瓦尼亚总分B分。根据这些信息,确定他们比赛的最多局数,或者情况是不可能发生的。 请注意,每一局都是完整的一局

加入题单

上一题 下一题 算法标签: