博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
A. The number of positions
阅读量:4336 次
发布时间:2019-06-07

本文共 1045 字,大约阅读时间需要 3 分钟。

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

 

转载于:https://www.cnblogs.com/-citywall123/p/9695827.html

你可能感兴趣的文章
Azure云服务托管恶意软件
查看>>
My安卓知识6--关于把项目从androidstudio工程转成eclipse工程并导成jar包
查看>>
旧的起点(开园说明)
查看>>
生产订单“生产线别”带入生产入库单
查看>>
crontab导致磁盘空间满问题的解决
查看>>
java基础 第十一章(多态、抽象类、接口、包装类、String)
查看>>
Hadoop 服务器配置的副本数量 管不了客户端
查看>>
欧建新之死
查看>>
自定义滚动条
查看>>
APP开发手记01(app与web的困惑)
查看>>
笛卡尔遗传规划Cartesian Genetic Programming (CGP)简单理解(1)
查看>>
mysql 日期时间运算函数(转)
查看>>
初识前端作业1
查看>>
ffmpeg格式转换命令
查看>>
万方数据知识平台 TFHpple +Xpath解析
查看>>
Hive实现oracle的Minus函数
查看>>
秒杀多线程第四篇 一个经典的多线程同步问题
查看>>
RocketMQ配置
查看>>
蚂蚁金服井贤栋:用技术联手金融机构,形成服务小微的生态合力
查看>>
端口号大全
查看>>