Logo
(追記) (追記ここまで)

16255번 - Martian Volleyball 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB23616514171.212%

문제

Volleyball match at Mars is played by two teams until one of the teams gets k points, with score at least 2 points more than the score of the other team. For each ball played exactly one of the teams gets 1 point.

Now the score of the first team if x, the score of the second team is y. What is the minimal number of balls that must be played until one of the teams wins the match?

입력

Input contains several test cases. The first line contains integer t — the number of cases (1 ≤ t ≤ 5000).

Each test case is described using one line that contains three integers separated by spaces: k, x and y (1 ≤ k ≤ 100; 0 ≤ x, y ≤ 100).

It is guaranteed that the score can be obtained in a correct unfinished game.

출력

For each test case print one line — the minimal number of balls to be played, until the match is finished.

제한

예제 입력 1

3
2 1 0
3 4 3
5 0 0

예제 출력 1

1
1
5

힌트

출처

Contest > Russian Code Cup > 2017 > RCC 2017 First Qualification Round A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /