1 求乱  利用随机数
2 没有明白什么意思
3 直接调用math函数,把公式的表达式写出来计算就是

解决方案 »

  1.   

    (m-n)!
    -------
      m!或者说 60 * 59 *  ...* 32 * 31
      

  2.   

    public class Permutation {
    public static long p(long arg0,long arg1) throws Exception{
    if(arg0<0 || arg1<0 || arg0 <arg1)throw new Exception("上标下标为正数,且上标大于下标");
    if(arg0 == arg1){
    return 0;
    }else if(arg0 == arg1 +1){
    return arg0*arg1;
    }else{
    return arg0*p(arg0-1,arg1)/(arg0-arg1);
    }
    }

    public static void main(String[] args){
    try {
    System.out.println(Permutation.p(60,2));
    } catch (Exception e) {
    System.out.println(e);
    }
    }
    }
      

  3.   

    这个排列还需要递归?一个简单的循环就够啦另外,如果需要精确,则最好使用BigInteger,如果不需要则把BigInteger改成double
        public static BigInteger p(int down, int up) {
    if (down < 0 || up < 0 || down < up)
    throw new IllegalArgumentException("上标下标为正数,且上标大于下标");
    BigInteger result = BigInteger.ONE;
    for(int i = down - up + 1; i <= down; i++)
    result = result.multiply(BigInteger.valueOf(i));
    return result;
    }
        
        public static BigInteger c(int down, int up) {
    if (down < 0 || up < 0 || down < up)
    throw new IllegalArgumentException("上标下标为正数,且上标大于下标");
    BigInteger result = BigInteger.ONE;
    for(int i = down - up + 1; i <= down; i++)
    result = result.multiply(BigInteger.valueOf(i));
    for(int i = 1; i <= up; i++)
    result = result.divide(BigInteger.valueOf(i));
    return result;
    }
      

  4.   

    不是让你发到SQL版去问的么,怎么发到这里来了??