QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

#16114. 어떤 거리도 너무 멀지 않다

Statistics

Alice와 Bob은 자신들을 포함해 $N$명이 서 있는 예방 접종 대기 줄 어딘가에 있습니다. 모두 마스크를 쓰고 거리를 유지하고 있어서 다른 사람을 알아보는 것은 거의 불가능합니다.

Alice는 자신의 앞에 $A$명이 서 있다고 세었고, Bob은 자신의 뒤에 $B$명이 서 있다고 세었습니다.

서로를 볼 수 없어도 두 사람은 자신들이 얼마나 떨어져 있는지 알고 싶어 합니다. Alice와 Bob 사이에 서 있는 사람의 수(두 사람은 제외)를 알아내도록 도와줄 수 있나요?

입력

한 줄에 세 정수 $N$, $A$, $B$($2 \le N \le 1000$, $0 \le A, B \le N - 1$; $A + B \ne N - 1$)가 주어집니다. 각각 줄에 서 있는 사람의 수, Alice 앞에 있는 사람의 수, Bob 뒤에 있는 사람의 수를 나타냅니다.

출력

Alice와 Bob 사이에 서 있는 사람의 수를 나타내는 정수 하나를 출력하세요.

예제

입력 1

10 2 3

출력 1

3

입력 2

7 4 5

출력 2

2

입력 3

998 244 353

출력 3

399

참고

첫 번째 예제에서 줄을 앞에서 뒤로 표현하면 ooAoooBooo입니다. 여기서 A는 Alice의 위치이고 B는 Bob의 위치입니다.

두 번째 예제에서 줄을 앞에서 뒤로 표현하면 oBooAoo입니다. 여기서 A는 Alice의 위치이고 B는 Bob의 위치입니다.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.