点击打开链接

A. The number of positions
time limit per test

0.5 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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 na 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<stdio.h>
#include<algorithm>
using namespace std;
int main()
{int n,a,b;scanf("%d%d%d",&n,&a,&b);printf("%d\n",min(n-a,b+1));return 0;
}

codeforces 124A The number of positions相关推荐

  1. CodeForces 991E Bus Number DFS+ 组合数

    CodeForces 991E Bus Number DFS+ 组合数 题目大意:给定一个数字,数字里出现的每一个数,都至少要用一个,问能组成多少个新数,不加前导零. input: 2028 outp ...

  2. Codeforces 40 E. Number Table

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

  3. 第11期《codeforces 1167A - Telephone Number 题解 》

    题目描述如下: A. Telephone Number time limit per test 1 second memory limit per test 256 megabytes input s ...

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

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

  5. 【CodeForces - 27E】Number With The Given Amount Of Divisors (数论,数学,反素数)

    题干: Given the number n, find the smallest positive integer which has exactly n divisors. It is guara ...

  6. Codeforces 1499D - The Number of Pairs(数论 + 组合计数)

    昨晚的cf没打,然后有人QQ问我D来着,正好在上毛概课可以划水就来口胡一波题解( 较为简单的套路题 ? (逃 简单实现一下就行了 ~ #include <bits/stdc++.h>usi ...

  7. Codeforces 991E. Bus Number (DFS+排列组合)

    解题思路 将每个数字出现的次数存在一个数组num[]中(与顺序无关). 将出现过的数字i从1到num[i]遍历.(i from 0 to 9) 得到要使用的数字次数数组a[]. 对于每一种a使用排列组 ...

  8. Codeforces 1430 A. Number of Apartments

    Recently a new building with a new layout was constructed in Monocarp's hometown. According to this ...

  9. 暑期集训3:几何基础 练习题F:  CodeForces - 1007A ​​​​​​​

    2018学校暑期集训第三天--几何基础 练习题F  --   CodeForces - 1007A Reorder the Array You are given an array of intege ...

最新文章

  1. git 无法拉取新的远程分支
  2. Xcode - Other Linker Flags
  3. 你不知道的CDN圈内黑话有哪些?
  4. 转:VMware、微软等四种主要的网络IO虚拟化模型
  5. 在html中定位属性怎么用,CSS元素定位的使用方法
  6. 力扣--189旋转数组(中等)
  7. 【机器学习】流程模板
  8. xml格式校验工具_logback 日志输出格式
  9. Linux成长之路-基础篇(2)
  10. 十二、I/O复用介绍
  11. cacti 监控添加插件
  12. 目标追踪论文之狼吞虎咽(4):MCCT算法
  13. 2003 服务器自动重启设置,Win2003定时自动重启的完美方案
  14. 阿里云 mysql yum源_安装阿里云yum源
  15. android游戏中期检查表,中期检查表教师评语
  16. Uhuntu搜狗拼音输入法安装详细过程
  17. ftp 发生意外错误 0x8ffe2740
  18. AD20/Altium designer——如何从立创EDA获取元器件封装库原理图库PCB库
  19. 塔米狗企业并购与投融资信息服务平台
  20. 做计算机视觉对电脑配置的要求,计算机视觉环境配置

热门文章

  1. Linux---fork函数和exec函数
  2. Oracle数据库之查询排序
  3. 分区命令Parted详解
  4. linux下实现QT计算器,Qt实现计算器
  5. 设计师福利!Adobe发布Typekit,分分钟帮你找到想要的字体
  6. 计算机网络mooc测验2
  7. yield和yield from使用
  8. 硅谷外卖学习日记之babelrc
  9. 华为交换机重制_华为交换机恢复出厂设置操作步骤
  10. ZBC陆续在主要CEX开启Staking成近期利好,锁定市场大部分流通量