A. The number of positions
0.5 second
256 megabytes
standard input
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.
The only line contains three integers n, a and b (0 ≤ a, b < n ≤ 100).
Print the single number — the number of the sought positions.
3 1 1
2
5 2 3
3
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的更多相关文章
- The number of positions
Description The number of positions time limit per test: 0.5 second memory limit per test: 256 megab ...
- Codeforces 124A - The number of positions
题目链接:http://codeforces.com/problemset/problem/124/A Petr stands in line of n people, but he doesn't ...
- 浙南联合训练赛 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 ...
- (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 ...
- [LeetCode] Total Hamming Distance 全部汉明距离
The Hamming distance between two integers is the number of positions at which the corresponding bits ...
- [LeetCode] Hamming Distance 汉明距离
The Hamming distance between two integers is the number of positions at which the corresponding bits ...
- Total Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits ...
- Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits ...
- 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 ...
随机推荐
- 激活 jave platform se
1.有的网页上面会显示这个,但是点击后没反应 解决方案: firefox- >工具-附加组件管理器-“插件” 找到“Java(TM) Platform SE 7”,把“询问是否激活”改为“总是激 ...
- jetty启动常用命令
1. 启动Jetty Server:运行命令:Java -jar start.jar 指定项目名称启动: java -jar start.jar -Dname=zoush 保持jetty后台 ...
- linux时区修改为中国时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
- 高性能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 ...
- R: 聚类分析
判别与聚类的比较: 聚类分析和判别分析有相似的作用,都是起到分类的作用. 判别分析是已知分类然后总结出判别规则,是一种有指导的学习: 聚类分析则是有了一批样本,不知道它们的分类,甚至连分成几类也不知道 ...
- WordCount编码与测试
1. github项目地址:https://github.com/wwwwu/WordCount 2.PSP表格: PSP2.1 PSP阶段 预估耗时 (分钟) 实际耗时 (分钟) Planning ...
- 《Head First Servlets & JSP》-3-1st servlet MVC demo
项目结构 用户首页 form.html <html> <body> <h1 align='center'>Beer Selection Page</h1> ...
- 2019年第十届蓝桥杯省赛总结(JavaA组)
//update3.28:省一rank4,莫名进了国赛好神奇.. 记yzm10第一次体验A组(纯粹瞎水). 早闻山东的JavaA组神仙打架,进国赛都成了奢望(往年只有五个名额),因此抱着做分母的心态来 ...
- c/c++ 字符编码与标识符
说明: 对于比较现代的语言来讲字符编码不是个大问题:java就可以使用中文作为变量名称,但对于C/C++来讲却不是这样,由于历史原因,标准和编译器厂商的实现总在不停的变化,相关编码信息到底是如何处理的 ...
- Chrom去掉"未选择任何文件"
<style> input[type="file"] { color: transparent; } </style>