题目链接:http://codeforces.com/problemset/problem/124/A

Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing behind him. Find the number of different positions Petr can occupy.

Input

The only line contains three integers n, a and b (0 ≤ a, b < n ≤ 100).

Output

Print the single number — the number of the sought positions.

Examples
Input
3 1 1
Output
2
Input
5 2 3
Output
3
Note

The possible positions in the first sample are: 2 and 3 (if we number the positions starting with 1).

In the second sample they are 3, 4 and 5.

题解:减去面前的与后面的再比较

 #include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
using namespace std;
#define N 100010
int main()
{
int n,a,b;
while(cin>>n>>a>>b){
int s=n-a;
if(s>b) s=b+;
cout<<s<<endl;
}
return ;
}

Codeforces 124A - The number of positions的更多相关文章

  1. The number of positions

    Description The number of positions time limit per test: 0.5 second memory limit per test: 256 megab ...

  2. Codeforces 55D Beautiful Number

    Codeforces 55D Beautiful Number a positive integer number is beautiful if and only if it is divisibl ...

  3. 浙南联合训练赛 H - The number of positions

    Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say ...

  4. A. The number of positions

    A. The number of positions time limit per test 0.5 second memory limit per test 256 megabytes input ...

  5. (Codeforce)The number of positions

    Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say ...

  6. Codeforces 40 E. Number Table

    题目链接:http://codeforces.com/problemset/problem/40/E 妙啊... 因为已经确定的格子数目严格小于了$max(n,m)$,所以至少有一行或者一列是空着的, ...

  7. codeforces Soldier and Number Game(dp+素数筛选)

    D. Soldier and Number Game time limit per test3 seconds memory limit per test256 megabytes inputstan ...

  8. Codeforces 55D Beautiful Number (数位统计)

    把数位dp写成记忆化搜索的形式,方法很赞,代码量少了很多. 下面为转载内容:  a positive integer number is beautiful if and only if it is  ...

  9. Codeforces 980E The Number Games 贪心 倍增表

    原文链接https://www.cnblogs.com/zhouzhendong/p/9074226.html 题目传送门 - Codeforces 980E 题意 $\rm Codeforces$ ...

随机推荐

  1. mysql主从调优

    mysql主从同步调优 常用选项 适用于Master服务器 binlog-do-db=name 设置Master对哪些库记日志 binlog-ignore-db=name 设置Master对哪些库不记 ...

  2. Python3学习之路~8.3 socket 服务端与客户端

    通过8.2的实例1-6,我们可以总结出来,socket的服务端和客户端的一般建立步骤: 服务端 步骤:1创建实例,2绑定,3监听,4阻塞,5发送&接收数据,6关闭. #Author:Zheng ...

  3. 我的DIY作品

    工欲善其事必先利其器~呵呵~我自己体会从无到有的乐趣~0~ 从Visio到CAD再到Autodesk,你妹的~只有自己才懂~哎~感谢兄弟朋友们的支持! Visio图: CAD图: Autodesk图:

  4. Redis入门到高可用(七)——Hash

    一.结构 Mapmap结构: filed 不能相同,value可以相同. 二.重要指令 ♦️ HSET  ♦️ HGET  ♦️ HDEL ♦️ Hlen  ♦️ HEXISTS ♦️HGETALL  ...

  5. vant - 弹框 【Popup 弹出层】【DatetimePicker 时间选择】

    [HelloWorld.vue] <template> <div class="hello"> <van-row class="m-head ...

  6. ionic 版本内更新问题汇总

    1.签名不一致导致的更新失败 2.解析软件包出现问题 3.当文件下载完.在android 8.0中不能打开apk包的问题 解决方案:在config.xml中添加: <platform name= ...

  7. 安装Cuda9.0+cudnn7.3.1+tensorflow-gpu1.13.1

    我的安装版本: win10 x64 VS2015 conda python 3.7 显卡 GTX 940mx Cuda 9.0 cudnn v7.3.1 Tensorflow-gpu 1.13.1 1 ...

  8. sparse.coo_matrix()

    coo_matrix.tocsr(copy = False ) 将此矩阵转换为压缩稀疏行格式,重复的条目将汇总在一起. 举例: from numpy import array from scipy.s ...

  9. Bukkit插件编程中.yml配置文件的创建和读取

    package com.sklm.config; import java.io.BufferedOutputStream; import java.io.BufferedReader; import ...

  10. Rstudio 01 连接MySQL

    > install.packages("RMySQL") also installing the dependency ‘DBI’ trying URL 'https://c ...