oj上java大数的使用

时间:2023-03-10 02:11:50
oj上java大数的使用
import java.math.BigInteger;
import java.util.Scanner; public class Main {//类名要用Main
public static void main(String[] args){ int T;
BigInteger N,M;
BigInteger MOD=new BigInteger("");
BigInteger ZERO=new BigInteger("");
Scanner sc=new Scanner(System.in); T=sc.nextInt();
while((T--)>){ N=sc.nextBigInteger();
M=sc.nextBigInteger(); if(N.compareTo(M)==&&N.mod(MOD).compareTo(ZERO)==){//
System.out.println("YES");
}
else{//
System.out.println("NO");
} } }
}

ps:取余最好用remainder,mod好像mod负数报错