9.5中兴笔试编程2代码
  使用BigInteger实现 
   做法十分暴力,一定要超时的,不知道用例有没有作时间限制。 
   贴出来给大家图一乐⑧ 
 
 import java.math.BigInteger;
import java.util.Scanner;
public class Solution2 {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int m =sc.nextInt();
		int k =sc.nextInt();
		BigInteger sum=new BigInteger("0");
		for (int i = 3; i <= n; i++) {
			for (int j = 2; j <= m; j++) {
				if(i+j==k) {
					BigInteger temp1 = get(new BigInteger(n+"")).divide(get(new BigInteger(i+"")).multiply(get(new BigInteger((n-i)+""))));
					BigInteger temp2 = get(new BigInteger(m+"")).divide(get(new BigInteger(j+"")).multiply(get(new BigInteger((m-j)+""))));
					sum= sum.add((temp1.multiply(temp2)));
					if (sum.intValue() > 1000000007) {
						sum = sum.remainder(new BigInteger("1000000007"));
					}
				}
			}
		}
		System.out.println(sum.remainder(new BigInteger("1000000007")));
		
	}
	private static BigInteger get(BigInteger m) {
		BigInteger temp = new BigInteger("1");
		if (m.intValue()==0) {
			return temp;
		}
		
		for (int i = 1; i <= m.intValue(); i++) {
			temp = temp.multiply(new BigInteger(i+""));
		}
		return temp;
	}
	
	
} 
查看16道真题和解析
