How many ways
Time Limit: 1 Sec Memory Limit: 128 MB
Cindy and Angela are good friends now. They can now go for an adventure without their dads. There are n houses with a road between every two houses in the village. The little girls decided to go to each house after dinner every evening as adventure.

They start from any house Cindy choose and return to the same house as an end of the adventure. But notice, Angela doesn’t like to walk a long way,she’s easy to get tired. So they don’t want to pass the same road for twice in any one of the adventures. How many fresh adventures they may have during the vacation.I’m sure it’s really an easy problem for you

传送门:SHUOJ1668

Input

There will be several test cases. And for each test case, there is one line of input containing n(1<=n<=50). A line containing 0 follows the last test case.

Output

For each test case, output a line giving the number of ways.

Sample Input

1
2
3
4
1
2
5
0

Sample Output

1
2
3
1
1
2

题解

简直神奇,随便写了下公式竟然过了 不要问我为什么,我也不知道。。。
## AC code:(不包含输入类)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.io.*; 
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
if(n==0) break;
else{
if(n==1){
System.out.println(1);
}
else if(n==2){
System.out.println(1);
}
else if(n==3){
System.out.println(1);
}
else
System.out.println((n-1)/2);
}
}
}
}