| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
大家帮忙看看为什么wa?import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static BigInteger fn(BigInteger n)
{
if(n.longValue()<=1)
{
return new BigInteger("1");
}else
{
return n.multiply(fn(n.subtract(new BigInteger("1"))));
}
}
/**
* @param args
*/
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int a=0,b=0;
//System.out.println(fn(new BigInteger("1000")));
a=in.nextInt();
b=in.nextInt();
while(a!=0&&b!=0){
BigInteger result=fn(new BigInteger(""+(a-b))).divide(fn(new BigInteger(""+(a-2*b))).multiply(fn(new BigInteger(""+b))));
System.out.println(result);
a=in.nextInt();
b=in.nextInt();
};
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator