http://codeforces.com/gym/100187/problem/A
有n种药,只有一瓶不是毒药,一只兔子每次和k种,问最坏的情况下最少毒死几只兔子。。。
思路:注意n=0,n=k,k=1的情况。
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
int i,j,k,n;
while(scanf("%d%d",&n,&k)!=EOF)
{
if(n==1)
{
printf("0\n");
continue;
}
if(n==k)
{
printf("-1\n");
continue;
}
if(k==1)
{
printf("%d\n",n-1);
continue;
}
if(n%k==0||n%k==1)
{
printf("%d\n",n/k);
}
else printf("%d\n",n/k+1);
}
return 0;
}