我想運行這段代碼,但我得到錯誤,我無法解決。請幫忙。不兼容的類型:BigInteger不能轉換爲int
import java.util.Scanner;
import java.math.BigInteger;
class Cseq
{
public static void main(String []args)
{
Scanner jais=new Scanner(System.in);
int x=100000;
BigInteger i;
BigInteger []a = new BigInteger[x];
a[0]=BigInteger.ONE;
for(i=BigInteger.ONE;i.compareTo(BigInteger.valueOf(x))<=0;i=i.add(BigInteger.ONE))
{
a[i]=a[(i.subtract(BigInteger.ONE))].multiply(i);
}
int t=jais.nextInt();
while(t--!=0)
{
BigInteger n=jais.nextBigInteger();
BigInteger p=jais.nextBigInteger();
BigInteger q=jais.nextBigInteger();
BigInteger v=(q.subtract(p)).add(BigInteger.ONE);
BigInteger j;
BigInteger sum=BigInteger.ZERO;
for(j=BigInteger.ONE;j.compareTo(n)<=0;j=j.add(BigInteger.ONE))
{
sum=sum.add(a[v].divide(a[(v.subtract(j))].multiply(a[j])));
sum=sum.add(v);
}
sum=sum.subtract(v);
System.out.println(sum);
}
jais.close();
}
}
http://ideone.com/Lq7KX7這裏是鏈接到這個問題.. – 2015-04-05 17:01:29