题目链接: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.
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>
#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的更多相关文章
-
The number of positions
Description The number of positions time limit per test: 0.5 second memory limit per test: 256 megab ...
-
Codeforces 55D Beautiful Number
Codeforces 55D Beautiful Number a positive integer number is beautiful if and only if it is divisibl ...
-
浙南联合训练赛 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 ...
-
A. The number of positions
A. The number of positions time limit per test 0.5 second memory limit per test 256 megabytes input ...
-
(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 ...
-
Codeforces 40 E. Number Table
题目链接:http://codeforces.com/problemset/problem/40/E 妙啊... 因为已经确定的格子数目严格小于了$max(n,m)$,所以至少有一行或者一列是空着的, ...
-
codeforces Soldier and Number Game(dp+素数筛选)
D. Soldier and Number Game time limit per test3 seconds memory limit per test256 megabytes inputstan ...
-
Codeforces 55D Beautiful Number (数位统计)
把数位dp写成记忆化搜索的形式,方法很赞,代码量少了很多. 下面为转载内容: a positive integer number is beautiful if and only if it is ...
-
Codeforces 980E The Number Games 贪心 倍增表
原文链接https://www.cnblogs.com/zhouzhendong/p/9074226.html 题目传送门 - Codeforces 980E 题意 $\rm Codeforces$ ...
随机推荐
-
Redis集群(三):主从配置一
一.本文目的 Redis的主从配置分为两篇文章,第一篇主要介绍了Redis主从配置的搭建过程及使用,第二篇主要说明各种情况下Redis主从状态,如Master挂掉,Slaver挂掉, ...
-
ember.js:使用笔记7 页面中插入效果
在某些情况下,我们需要根据数据生成某些效果:由于每个模版的controller可能不同,在不同页面之间跳转可能会无法随即更新的问题. controller: 直接使用标签:{{}},适用于在子项目内切 ...
-
Period[HDU1358]
Period Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Sub ...
-
20169210《Linux内核原理与分析》第四周作业
网易云课堂学习: 在实验楼的学习中,这次的实验是利用mykernel实验模拟计算机硬件平台 首先进入linux-3.9.4, $cd LinuxKernel/linux-3.9.4 如下图所示 接下来 ...
-
HTML5新增的属性和废除的属性
HTML5中,在新增加和废除很多元素的同时,也增加和废除了很多属性. 新增的属性 1.表单相关的属性 对input(type=text).select.textarea与button指定autofoc ...
-
C#编程断点续传
C#编程总结(十二)断点续传 Posted on 2014-02-16 10:56 停留的风 阅读(384) 评论(3) 编辑 收藏 C#编程总结(十二)断点续传 我们经常使用下载工具,如bit精灵. ...
-
【MySQL】使用 Optimizer Trace 观察SQL执行过程
Optimizer Trace 是MySQL 5.6.3里新加的一个特性,可以把MySQL Optimizer的决策和执行过程输出成文本.输出使用JSON格式,便于程序分析和人类阅读. 使用方法 1) ...
-
TensorFlow-谷歌深度学习库 命令行参数
程序的入口: tf.app.run tf.app.run( main=None, argv=None ) 运行程序,可以提供'main'函数以及函数参数列表.处理flag解析然后执行main函数. 什 ...
-
HMM模型和Viterbi算法
https://www.cnblogs.com/Denise-hzf/p/6612212.html 一.隐含马尔可夫模型(Hidden Markov Model) 1.简介 隐含马尔可夫模型并不是俄罗 ...
-
使用nproxy代理本地服务到内网
前端开发中:很多场景需要在局域网下的其他手机或设备查看网页, 问题来了, web服务部署在本机的某个端口上(8080),只能通过本机浏览器访问, 怎样能让局域网下的其他设备也访问呢?可能你会说 关闭 ...