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

9349번 - Fegla and the Bed Bugs 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB34217216061.303%

문제

Fegla, also known as mmaw, is coaching a lot of teams. All these teams train together in one place, unfortunately this place doesn’t have any good ventilation and is quite small relative to the number of teams. All these circumstances resulted in a strange creature appearing! That creature is called The Bed Bug!

These are parasitic bugs; they feed on human blood by biting them. What was strange and confused Fegla, is that some of the team members did not get bitten at all! However, he was more interested in eliminating these bugs. After observing the bugs’ behavior for some time, he concluded that he needed to stop them from reproducing to eliminate them. They reproduce by getting very close to each other.

And so, Fegla needs your help. Given a straight line of empty cells N and the number of bugs K, tell Fegla the best assignment for the bugs to maximize the minimum number of empty cells between each two consecutive bugs on that line.

For example, given N=4 and K=2, the answer would be 2, according to the best assignment:

Bed Bug Empty Empty Bed Bug

입력

Input will start with an integer T representing the number of test cases. Followed by T lines each line contains two integers N, K.

You can assume that

  • 2 ≤ N ≤ 200
  • 2 ≤ K ≤ N

출력

For each test case in a separate line, output the minimum distance between EACH two consecutive bugs in the best assignment.

제한

예제 입력 1

2
4 2
3 2

예제 출력 1

2
1

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > ACM Jordanian Collegiate Programming Contest > JCPC 2012 A번

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

출처

대학교 대회

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

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