codeforces 124A The number of positions
  ZUYoXUC2NAq7 2023年11月02日 60 0


​点击打开链接​

A. The number of positions

time limit per test

memory limit per test

input

output

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

Input

na and b (0 ≤ a, b < n ≤ 100).

Output

Print the single number — the number of the sought positions.

Examples

input

3 1 1

output

2

input

5 2 3

output

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<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;
}



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
  OK0d47OJKrH5   2023年11月02日   58   0   0 #includeide#define
  5inlEEFCT2X0   2023年11月02日   112   0   0 #include折半查找
  dUbcXj9lnElT   2023年11月02日   49   0   0 #includei++c++
  dUbcXj9lnElT   2023年11月02日   38   0   0 #include连通块i++
ZUYoXUC2NAq7
最新推荐 更多