题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1273
题解:设森林里有N块空地,任意两块空地之间都有一条小径相通,与每块空地相连的路径数为n-1;每经过一块空地(一进一出)经过两条路径,所以答案为(n-1)/2.
#include <stdio.h>
int main()
{
int n;
while(scanf("%d",&n)&&n)
{
printf("%d\n",(n-1)/2);
}
return 0;
}