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

Copy
3 1 1
output

Copy
2
input

Copy
5 2 3
output

Copy
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>
using namespace std;
int main()
{
int n,a,b;
while(cin>>n>>a>>b)
{
int cnt=;
for(int i=;i<n;i++)
{
if(i>=a&&n-i-<=b)
cnt++;
}
cout<<cnt<<endl;
}
return ;
}

A. 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 124A - The number of positions

    题目链接:http://codeforces.com/problemset/problem/124/A Petr stands in line of n people, but he doesn't ...

  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. (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 ...

  5. [LeetCode] Total Hamming Distance 全部汉明距离

    The Hamming distance between two integers is the number of positions at which the corresponding bits ...

  6. [LeetCode] Hamming Distance 汉明距离

    The Hamming distance between two integers is the number of positions at which the corresponding bits ...

  7. Total Hamming Distance

    The Hamming distance between two integers is the number of positions at which the corresponding bits ...

  8. Hamming Distance

    The Hamming distance between two integers is the number of positions at which the corresponding bits ...

  9. 461. Hamming Distance and 477. Total Hamming Distance in Python

    题目: The Hamming distance between two integers is the number of positions at which the corresponding ...

随机推荐

  1. day17-jdbc 1.课程介绍

  2. day17 14.dao模式介绍

    Web的三层架构,不是MVC,Web层,Service层,DAO层. 之前玩的JSP Servlet JavaBean那是MVC模式,那玩意只是表现层的东西. 转账汇款的例子. 说了这么多有啥用啊,一 ...

  3. nyoj42欧拉回路

    一笔画问题 时间限制:3000 ms  |  内存限制:65535 KB 难度:4   描述 zyc从小就比较喜欢玩一些小游戏,其中就包括画一笔画,他想请你帮他写一个程序,判断一个图是否能够用一笔画下 ...

  4. ArcGIS Field Type /esriFieldTypeDate(转)

    ArcGIS Field Type   The following table outlines the equivalent field data types in ArcCatalog, ArcO ...

  5. Blender 基础 骨架 01

    Blender 基础 骨架 01 我使用的Blender版本:Blender V 2.77 前言 本讲介绍: 骨架的基本使用方式. 骨架是角色动画里面最常使用的元素,它可以准确控制一个模型的变形,尤其 ...

  6. 高性能MySQL笔记-第5章Indexing for High Performance-002Hash indexes

    一. 1.什么是hash index A hash index is built on a hash table and is useful only for exact lookups that u ...

  7. 855C Helga Hufflepuff's Cup

    传送门 题目大意 给你一棵树,可以染m种颜色,现定义一种特殊的颜色K,一棵树上最多能有x个特殊颜色.如果一个节点为特殊颜色,那么他相邻的节点的值只能选比K小的颜色,问一共有多少种染色方案. 分析 不难 ...

  8. C++面试笔记--指针和引用

    面试一:指针与引用的区别? 答案: (1)非空区别.在任何情况下都不能使用指向空值的引用.因此如果你使用一个变量并让它指向一个对象,但是该变量在某些时候也可能不指向任何对象,这时你应该把变量声明为指针 ...

  9. C#数据类型及差异(复习专用)

    一.数据类型 值类型 类型 描述 范围 默认值 bool 布尔值 True 或 False False byte 8 位无符号整数 0 到 255 0 char 16 位 Unicode 字符 U + ...

  10. sqlserver小批量导数据

     USE [KM_Voice]  GO  /****** Object: StoredProcedure [dbo].[proc_insert] Script Date: 01/09/2015 18: ...