CodeForces
来源:互联网 发布:nba2k17麦迪动作数据 编辑:程序博客网 时间:2024/06/06 09:46
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 ≤ 109, 0 ≤ a, b ≤ 109, a + b > 0).
If the situation is impossible, print a single number -1. Otherwise, print the maximum possible number of sets.
11 11 5
1
11 2 3
-1
小细节题:
#include<stdio.h>#include<string.h>using namespace std;int main(){ int k,n,m; while(~scanf("%d%d%d",&k,&n,&m)) { int res=0; res+=(n/k); res+=(m/k); if(n%k&&m<k||(m%k&&n<k)) { printf("-1\n"); continue; } if(res) printf("%d\n",res); else printf("-1\n"); }}
- codeforces~~~
- Codeforces
- codeforces
- Codeforces
- codeforces
- codeforces
- Codeforces
- Codeforces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- CodeForces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- Codeforces
- TabLayout,viewpaper,frment获取轮播图
- 使用handlebars时script标签中如何获取后台传递的数据
- 【矩阵模板】
- 分组背包
- 深度学习中噪声标签的影响和识别
- CodeForces
- JSP自定义标签
- C语言实现课程设计
- Java微信公众号开发面试题
- <c:forEach> 标签使用
- LCD(一):LCD基本原理篇
- Android在一个app中实现另一个app的自动安装,安装完成后自动打开(需Root)
- sqlmap教程(burpsuit辅助)
- Python web入门:Django学习与实践二(简单页面实现和创建一个模板)