2015山东省第六届ACM省赛 Single Round Math
2016-04-06 21:34
260 查看
题意:n,m个男女,凑成n对couple,最后分成11个组,检测能否分成。
思路:java大数。n==m才可以成couple,最后mod 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"); } } } }
相关文章推荐
- 利用递归分割(Split)字符串
- WIN32汇编定时器的使用
- A2
- Apache Kylin在百度地图的实践
- NEU 1007 (字典树 DP)
- 开源思想
- 第六周周记
- 杭电2131
- Xen-Server 6.5 从虚拟机快照中创建虚拟机模板
- Golang输出颜色
- 7、Mysql的log-bin日志
- 终于懂了:Delphi消息的Result域出现的原因——要代替回调函数的返回值!(MakeObjectInstance不会帮助处理(接收)消息回调函数的返回值)
- c++ lesson 一(命名空间输入输出)
- 转载:分布式Session共享:tomcat+memcached实现session共享
- HttpClient学习
- [置顶] JavaSE学习笔记_14:Java-Runtime类
- oracel 备份恢复之 recover database的四条语句的区别
- C++顺序性容器、关联性容器与容器适配器
- 小白在ubuntu14.04上利用putty访问服务器
- Android 引导使用说明、标签功能的封装库