中国剩余定理 非互质(java大数)

import java.math.BigInteger;
import java.util.Scanner;
 
public class Main { 
	static BigInteger dd;
	static BigInteger  xx;
	static BigInteger yy;
	static BigInteger []a = new BigInteger [1005];
	static BigInteger []r = new BigInteger [1005];
	static BigInteger o = BigInteger.ONE;
	static BigInteger z = BigInteger.ZERO; 
	static long f [] = new long [100];
	public static BigInteger[] ex_gcd1(BigInteger a,BigInteger b)	{ 
		BigInteger ans; BigInteger[] result=new BigInteger[3]; 
		if(b.compareTo(BigInteger.ZERO) == 0) { 
			result[0]=a;
			result[1]=o; 
			result[2]=z; 
			return result;
		} 
		BigInteger [] temp=ex_gcd1(b,a.mod(b)); 
		ans = temp[0]; 
		result[0]=ans; 
		result[1]=temp[2];
		result[2]=temp[1].subtract((a.divide(b)).multiply(temp[2]));
		return result; 
	} 
	static BigInteger Chinaa(int len) { //n % a[i] = r[i]
		BigInteger M=a[0],R=r[0];
		for(int i=1; i0) {
			  System.out.println("Tankernb!");
		  }
		  else {
			  boolean flag=false;
			  for (int i = 0; i <= 80;i++) {
				  if(w.compareTo(BigInteger.valueOf(f[i]))==0) {
					flag=true;  
					break;
				  }
			  }
			  if(flag) System.out.println("Lbnb!");
			  else System.out.println("Zgxnb!");
		  }
			
	}
}

 

你可能感兴趣的:(模板)