大意:
题意不好翻译,英文看懂也不是非常麻烦,就不翻译了。
。
。非常无语
。。 比赛结束也没搞出来。
。
	import java.io.*;
	import java.math.*;
	import java.util.*;
	public class Main {            
		
		static BigInteger coe[][] = new BigInteger [3010][3010];
		public static void main(String[] args) throws IOException{
			Scanner cin = new Scanner(System.in);
			BigInteger []a = new BigInteger[3010];  
	        BigInteger []c = new BigInteger[3010]; 
			int T;
			T = cin.nextInt();
			while(T-- > 0){
				int n;
				n = cin.nextInt();
				for(int i = 1; i <= n; ++i){
					a[i] = cin.nextBigInteger();
				}
				BigInteger ans = BigInteger.ZERO;
				c[0] = BigInteger.ONE;
				ans = ans.add(c[0].multiply(a[n]));
				int t = -1;
				for(int i = 1; i < n; ++i){
					BigInteger t1 = BigInteger.valueOf(n).subtract(BigInteger.valueOf(i));  
	                BigInteger t2 = BigInteger.valueOf(i);
	                c[i] = c[i-1].multiply(t1).divide(t2); 
	                ans = ans.add(c[i].multiply(a[n-i]).multiply(BigInteger.valueOf(t)));
	                t *= -1; 
				}
				System.out.println(ans);
			}
			
		}
	}
原文:http://www.cnblogs.com/yutingliuyl/p/6719354.html