您的位置:首页 > 其它

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

2016-04-06 21:34 260 查看
题意: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");
}

}

}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: