codeforces 124A 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<stdio.h>
#include<algorithm>
using namespace std;
int main()
{int n,a,b;scanf("%d%d%d",&n,&a,&b);printf("%d\n",min(n-a,b+1));return 0;
}
codeforces 124A The number of positions相关推荐
- CodeForces 991E Bus Number DFS+ 组合数
CodeForces 991E Bus Number DFS+ 组合数 题目大意:给定一个数字,数字里出现的每一个数,都至少要用一个,问能组成多少个新数,不加前导零. input: 2028 outp ...
- Codeforces 40 E. Number Table
题目链接:http://codeforces.com/problemset/problem/40/E 妙啊... 因为已经确定的格子数目严格小于了$max(n,m)$,所以至少有一行或者一列是空着的, ...
- 第11期《codeforces 1167A - Telephone Number 题解 》
题目描述如下: A. Telephone Number time limit per test 1 second memory limit per test 256 megabytes input s ...
- Codeforces 55D Beautiful Number (数位统计)
把数位dp写成记忆化搜索的形式,方法很赞,代码量少了很多. 下面为转载内容: a positive integer number is beautiful if and only if it is ...
- 【CodeForces - 27E】Number With The Given Amount Of Divisors (数论,数学,反素数)
题干: Given the number n, find the smallest positive integer which has exactly n divisors. It is guara ...
- Codeforces 1499D - The Number of Pairs(数论 + 组合计数)
昨晚的cf没打,然后有人QQ问我D来着,正好在上毛概课可以划水就来口胡一波题解( 较为简单的套路题 ? (逃 简单实现一下就行了 ~ #include <bits/stdc++.h>usi ...
- Codeforces 991E. Bus Number (DFS+排列组合)
解题思路 将每个数字出现的次数存在一个数组num[]中(与顺序无关). 将出现过的数字i从1到num[i]遍历.(i from 0 to 9) 得到要使用的数字次数数组a[]. 对于每一种a使用排列组 ...
- Codeforces 1430 A. Number of Apartments
Recently a new building with a new layout was constructed in Monocarp's hometown. According to this ...
- 暑期集训3:几何基础 练习题F: CodeForces - 1007A
2018学校暑期集训第三天--几何基础 练习题F -- CodeForces - 1007A Reorder the Array You are given an array of intege ...
最新文章
- git 无法拉取新的远程分支
- Xcode - Other Linker Flags
- 你不知道的CDN圈内黑话有哪些?
- 转:VMware、微软等四种主要的网络IO虚拟化模型
- 在html中定位属性怎么用,CSS元素定位的使用方法
- 力扣--189旋转数组(中等)
- 【机器学习】流程模板
- xml格式校验工具_logback 日志输出格式
- Linux成长之路-基础篇(2)
- 十二、I/O复用介绍
- cacti 监控添加插件
- 目标追踪论文之狼吞虎咽(4):MCCT算法
- 2003 服务器自动重启设置,Win2003定时自动重启的完美方案
- 阿里云 mysql yum源_安装阿里云yum源
- android游戏中期检查表,中期检查表教师评语
- Uhuntu搜狗拼音输入法安装详细过程
- ftp 发生意外错误 0x8ffe2740
- AD20/Altium designer——如何从立创EDA获取元器件封装库原理图库PCB库
- 塔米狗企业并购与投融资信息服务平台
- 做计算机视觉对电脑配置的要求,计算机视觉环境配置