题目链接: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. Django-认证系统

    一.Django实现cookie与session 一.Django实现的cookie 1.获取cookie request.COOKIES['key'] request.get_signed_cook ...

  2. Case when then esle end

    Case具有两种格式.简单Case函数和Case搜索函数. --简单Case函数 CASE sex ' THEN '男' ' THEN '女' ELSE '其他' END --Case搜索函数 ' T ...

  3. TVTK安装

    首先感觉到的一点就是在https://www.lfd.uci.edu/~gohlke/pythonlibs/#chaco这个比较受欢迎的下载Python库的网站上下载大于20mb的whl文件时就很可能 ...

  4. Express web框架 upload file

    哈哈,敢开源,还是要有两把刷子的啊 今天,看看node.js 的web框架 Express的实际应用 //demo1 upload file <html><head><t ...

  5. cocos2dx 3.x(绘制线条)

    // //  MainScene.hpp //  helloworld // //  Created by apple on 16/9/19. // // #ifndef MainScene_hpp ...

  6. C Alyona and Spreadsheet Codeforces Round #401(Div. 2)(思维)

    Alyona and Spreadsheet 这就是一道思维的题,谈不上算法什么的,但我当时就是不会,直到别人告诉了我,我才懂了的.唉 为什么总是这么弱呢? [题目链接]Alyona and Spre ...

  7. DateTime.Compare(t1,t2)比较两个日期大小

    DateTime.Compare(t1,t2)比较两个日期大小,排前面的小,排在后面的大,比如:2011-2-1就小于2012-3-2返回值小于零:  t1 小于 t2. 返回值等于零 : t1 等于 ...

  8. MongoDB--$project和$push的区别

    正文开始前,首先需要表名几条定义: 聚合(aggregate)是基于数据处理的聚合管道,每个文档通过一个由多个阶段(stage)组成的管道,可以对每个阶段的管道进行分组.过滤等功能,然后经过一系列的处 ...

  9. opencv的安装及填坑

    opencv的配置方式: https://blog.csdn.net/cocoaqin/article/details/78163171 输入Python时候报错: ERROR: ld.so: obj ...

  10. html5-相对定位

    *{    margin: 0px;    padding: 0px;}div{    width: 300px;    height: 300px;}#div1{    background: rg ...