Codeforces 124A - The number of positions
题目链接: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$ ...
随机推荐
- Linux系统上传文件与下载文件命令
我们用的服务器都是Linux系统的,如果用的是远程服务器,就需要将我们的代码推送过去,这里可以用到PSCP命令. (一)上传 pscp 本机文件的路径以及文件名 远程主机的用户名@远程主机IP:想要存 ...
- wxPython:事件处理一
事件处理是wxPython程序工作的基本机制,先看几个术语: 事件(event):应该程序期间发生的事情,要求有一个响应. 事件对象(event object):代表具体一个事件,包括事件的数据属性, ...
- UE4程序及资源加密保护方案
UnrealEngine4外壳加密 . Virbox Protector 解决代码反汇编和反dump代码,解决软件盗版与算法抄袭. 虚幻引擎4是由游戏开发者为开发游戏而制作的.完整的游戏开发工具套件. ...
- Exception in thread “main” java.sql.SQLException: No suitable driver
问题背景:通过Spark SQL的jdbc去读取Oracle数据做测试,在本地的idea中没有报任务错误.但是打包到集群的时候报: Exception in thread “main” java.sq ...
- windows端口占用情况
https://jingyan.baidu.com/article/3c48dd34491d47e10be358b8.html netstat -ano,列出所有端口的情况. netstat -aon ...
- 无法连接 MKS:套接字连接尝试次数太多正在放弃
我的电脑 -> 右键 -> 管理 -> 服务和应用程序 -> 服务: 开启下面的服务: 服务启动成功后,重启虚拟机; 或者先挂起虚拟机,等服务启动后,继续运行挂起的虚拟机:
- js图片压缩
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Entity Framework学习初级篇1--EF基本概况《转》
最近在学习研究微软的EF,通过这时间的学习研究,感觉这个EF目前来说还不是很完善,半成品.不过,据说在.Net4.0中,微软将推荐使用此框架,并会有所改善.而且,现在基本上所有数据库均提供了对EF的支 ...
- 一个简单的sel server 函数的自定义
创建自定义函数:use 数据库名gocreate function 函数名(@pno int)returns intasbegin declare @a int if not exists(se ...
- 《算法笔记》8.1小节——搜索专题->深度优先搜索(DFS)
http://codeup.cn/contest.php 5972 这是递归的入门题,求全排列,第一种方法用STL中的函数next_permutation,可以很容易的实现.首先建立好数组,将需要全排 ...