Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

大家帮忙看看为什么wa?

Posted by dragonshrimp at 2006-11-11 00:48:32 on Problem 1283
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator