• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
HaibaraAi
博客园    首页    新随笔    联系   管理    订阅  订阅

Warm up 3 [A] Fegla and the Bed Bugs

你为何这么叼!

[A] Fegla and the Bed Bugs

 

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 Specification
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 


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

 

Sample Input
2

4 2

3 2


Sample Output
2

1

 

 1 #include <cstdio>
 2 #include <vector>
 3 #include <cstring>
 4 #include <queue>
 5 #include <algorithm>
 6 using namespace std;
 7 #define maxn 1001
 8 int n,m;
 9 int main(){
10     int t;
11     scanf("%d",&t);
12     while(t--){
13         scanf("%d%d",&n,&m);
14         printf("%d\n",(n-1)/(m-1)-1);
15     }
16     return 0;
17 }
View Code 2013-10-07 22:04:46 

 

posted @ 2013-10-07 22:03  HaibaraAi  阅读(128)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3