2013
11-10

# Game of Connections

This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n – 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to draw some straight line segments to connect them into number pairs. Every number must be connected to exactly one another.

And, no two segments are allowed to intersect.

It’s still a simple game, isn’t it? But after you’ve written down the 2n numbers, can you tell me in how many different ways can you connect the numbers into pairs? Life is harder, right?

Each line of the input file will be a single positive number n, except the last line, which is a number -1.

You may assume that 1 <= n <= 100.

For each n, print in a single line the number of ways to connect the 2n numbers into pairs.

2
3
-1

2
5

import java.io.*;
import java.util.*;
import java.math.BigInteger;
public  class Main {
public static void main(String[]args){
Scanner sin=new Scanner(new BufferedInputStream(System.in));
int n;
int i = 0;
BigInteger big[] = new BigInteger[101];
for(i = 0 ; i < 101 ; i++)
big[i] = new BigInteger("0");
for(i=2; i < 101 ; i++){
for(int j = 0 ; j < i ; j++){
}
}

while(true){
n=sin.nextInt();
if(n == -1)break;
System.out.println(big[n].toString());

}

}
}

1. 因为是要把从字符串s的start位到当前位在hash中重置，修改提交后能accept，但是不修改居然也能accept

2. 其实国内大部分公司对算法都不够重视。特别是中小型公司老板根本都不懂技术，也不懂什么是算法，从而也不要求程序员懂什么算法，做程序从来不考虑性能问题，只要页面能显示出来就是好程序，这是国内的现状，很无奈。