private int combination(int n, int k)
    {
        if(n>>1 < k)
            k = n - k;
	    double mul = 1;
	    for(int i=n+1-k;i<n+1;i++)
		    mul *= i;
	    for(int i=k;i>0;i--)
		    mul /= i;
            //fload division might not be accurate
	    return (int)(mul+0.5);
    }