A10844 | Table Tennis Game 2
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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>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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted