2015山东省第六届ACM省赛 Single Round Math

题意:n,m个男女,凑成n对couple,最后分成11个组,检测能否分成。

思路:java大数。n==m才可以成couple,最后mod 11。

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("11");
        BigInteger ZERO=new BigInteger("0");
        Scanner sc=new Scanner(System.in);
        
        T=sc.nextInt();
        while((T--)>0){
            
            N=sc.nextBigInteger();
            M=sc.nextBigInteger();
            
            if(N.compareTo(M)==0&&N.mod(MOD).compareTo(ZERO)==0){//
                System.out.println("YES");
            }
            else{//
                System.out.println("NO");
            }
            
        }
        
    }
} 

你可能感兴趣的:(2015山东省第六届ACM省赛 Single Round Math)