题目链接: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. 20181226 PL/SQL批量生产处理语句

    总有那么些时候,对某些特定条件的数据需要做更新或者修改,或者Truncate特定的一些表,而你又不想要每一个表都去写Truncate table 语句. 那么可以采用Select 的拼接语句 如下: ...

  2. 算法笔记-PHP实现队列的操作

    [队列]先进者先出,这就是典型的“队列”.         最基本的两个操作:入队enqueue(),放一个数据到队列尾部:出队dequeue(),从队列头部取一个元素.队列可以用数组或者链表实现,用 ...

  3. JMeter TCP性能测试

    jmeter是一款纯java的性能测试工具,跨平台运行方便.提供图形化界面设置.简单易用.     在性能测试方法论中,很典型的方法就是二八原则,量化业务需求. 二八原则:指80%的业务量在20%的时 ...

  4. svn ignore 的用法

    一个很简单的需求,我想在add一个文件时忽略里面某种格式的文件,怎么弄? 选中文件夹,然后tortoiseSvn->setting-> global ignore pattern:是客户端 ...

  5. cocos2d JS-(JavaScript) 基础语法间的函数方法相互调用

    1.函数嵌套函数 function calcuate(opr, a, b) { // 定义函数,opr - -> 符号,a,b - -> 数值 //定义 + 函数 function add ...

  6. Adobe Flash Builder 调试器无法连接,无法进行调试,构建停止在57%

    参考:https://blog.csdn.net/wuboyaogun1/article/details/9105373 谷歌浏览器下载Flash debugger :Download the Win ...

  7. MFC CEdit控件 自动换行

    属性设置: Auto HScroll : False Auto VScroll : True Multiline        : Ture Want Return : Ture 亲自测试,值得信赖!

  8. css 清除一些默认的设置

    一.input标签的placeholder的设置 input::-webkit-input-placeholder{ /*WebKit browsers*/ //重置样式 } input::-moz- ...

  9. LeetCode88.合并两个有序数组

    给定两个有序整数数组 nums1 和 nums2,将 nums2 合并到 nums1 中,使得 num1 成为一个有序数组. 说明: 初始化 nums1 和 nums2 的元素数量分别为 m 和 n. ...

  10. Git branch 分支与合并分支

    Git branch 分支 查看当前有哪些branch bixiaopeng@bixiaopengtekiMacBook-Pro xmrobotium$ git branch * master 新建一 ...