题目链接:http://codeforces.com/contest/658/problem/C
思路:特判d==1的情况
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
int n,d,h;
int main()
{
scanf("%d%d%d",&n,&d,&h);
if(d==1)
{
if(n!=2||h!=1)
{
printf("-1\n");
return 0;
}
}
if(2*h<d||n<d+1)
{
printf("-1\n");
return 0;
}
int j=2;
for(int i=1;i<=h;i++)
{
printf("%d %d\n",j-1,j);
j++;
}
int tem=d-h;
if(tem)
{
tem--;
printf("%d %d\n",1,j);
j++;
}
for(int i=1;i<=tem;i++)
{
printf("%d %d\n",j-1,j);
j++;
}
for(;j<=n;j++)
{
printf("%d %d\n",h,j);
}
}