/**
* Created by Administrator on 2015/5/21.
*/
public class E15 {
public static long compute(long bigNumber,long smallNumber)
{
long result=1;
long cycleIndex=bigNumber-smallNumber;
int devide=1;
for(long i=0;i<cycleIndex;i++)
{
result*=bigNumber--;
result/=devide++;
}
return result;
}
public static void main(String[] args) {
long stareTime=System.currentTimeMillis();
long result=compute(40,20);
System.out.println(result);
long endTime=System.currentTimeMillis();
System.out.println(endTime-stareTime+" ms");
}
}
时间是 0ms。/** * Created by Administrator on 2015/5/21. */public class E15 { public static long compute(long bigNumber,long smallNumber) { long result=1; long cycleInd