Codeforces Gym100735 I.Yet another A + B-Java大数 (KTU Programming Camp (Day 1) Lithuania, Birˇstonas, August 19, 2015)
I.Yet another A + B
You are given three numbers. Is there a way to replace variables A, B and C with these numbers so the equality A + B = C is correct?
Input
There are three numbers X1, X2 and X3 (1 ≤ Xi ≤ 10100), each on a separate line of input.
Output
either "YES if there is a way to substitute variables A, B and C with given numbers so the equality is correct, or "NO"otherwise.
Examples
input
1 2 3
output
YES
input
1 2 4
output
YES
input
1 3 5
output
NO
大数计算,给出的数任选2个相加能否等于第三个数或者重复选1个数相加是否等于剩下的2个中的1个,因为是大数,所以直接用Java写的,偷懒专用,哈哈哈哈哈哈。
代码:
1 import java.util.Scanner;
2
3 public class BigInteger {
4 private static Scanner cin;
5
6 public static void main(String[] args) {
7 cin = new Scanner(System.in);
8 java.math.BigInteger a;
9 java.math.BigInteger b;
10 java.math.BigInteger c;
11 a = cin.nextBigInteger();
12 b = cin.nextBigInteger();
13 c = cin.nextBigInteger();
14 if((a.add(b)).compareTo(c)==0)System.out.println("YES\n");
15 else if((a.add(c)).compareTo(b)==0)System.out.println("YES\n");
16 else if((b.add(c)).compareTo(a)==0)System.out.println("YES\n");
17 else if((a.add(a)).compareTo(b)==0||(a.add(a)).compareTo(c)==0)System.out.println("YES\n");
18 else if((b.add(b)).compareTo(a)==0||(b.add(b)).compareTo(c)==0)System.out.println("YES\n");
19 else if((c.add(c)).compareTo(a)==0||(c.add(c)).compareTo(b)==0)System.out.println("YES\n");
20 else System.out.println("NO\n");
21 }
22 }
Codeforces Gym100735 I.Yet another A + B-Java大数 (KTU Programming Camp (Day 1) Lithuania, Birˇstonas, August 19, 2015)的更多相关文章
- Codeforces Gym100735 G.LCS Revised (KTU Programming Camp (Day 1) Lithuania, Birˇstonas, August 19, 2015)
G.LCS Revised The longest common subsequence is a well known DP problem: given two strings A and B ...
- Codeforces Gym100735 E.Restore (KTU Programming Camp (Day 1) Lithuania, Birˇstonas, August 19, 2015)
E - Restore Given a matrix A of size N * N. The rows are numbered from 0 to N-1, the columns are num ...
- Codeforces Gym100735 D.Triangle Formation (KTU Programming Camp (Day 1) Lithuania, Birˇstonas, August 19, 2015)
日常训练题解 D.Triangle Formation You are given N wooden sticks. Your task is to determine how many triang ...
- java大数
java大数还是很好用的! 基本加入: import java.math.BigInteger; import jave.math.BigDecimal; 分别是大数和大浮点数. 首先读入可以用: S ...
- JAVA大数运算
java大数是个好东西,用起来方便,代码短. 代码如下: import java.util.*; import java.math.*; public class Main { public stat ...
- java大数总结【转】
java大数(2013长春网络赛)--hdu4762总结一下:1.java提交类要写Main.2.读取大数. Scanner read=new Scanner(System.in); BigInteg ...
- HDU5047Sawtooth(java大数)
HDU5047Sawtooth(java大数) 题目链接 题目大意:在一个矩形内画n个"M".问如何画可以把这个矩形分成最多的区域. 给出这个区域的数目. 解题思路:最好的方式就是 ...
- JAVA大数类
JAVA大数类api http://man.ddvip.com/program/java_api_zh/java/math/BigInteger.html#method_summary 不仅仅只能查J ...
- HDU4762(JAVA大数)
Cut the Cake Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
随机推荐
- Fire Game FZU - 2150 (bfs)
Problem 2150 Fire Game Accept: 3772 Submit: 12868Time Limit: 1000 mSec Memory Limit : 32768 KB ...
- Codeforces Round #461 (Div. 2) A. Cloning Toys
A. Cloning Toys time limit per test 1 second memory limit per test 256 megabytes Problem Description ...
- SSRS 制作报表时报错: 超时时间已到。在操作完成之前超时时间已过或服务器未响应。
转载注明出处,原文地址:http://www.cnblogs.com/zzry/p/5718739.html 在用ssrs 制作报表时报如下错误 错误信息截图: 看到如上错误第一个想到的解决方法就是 ...
- 数据库——MySQL进阶
1.索引 2.触发器 3.存储过程 4.函数 5.事务 6.视图 1.索引 索引,是数据库中专门用于帮助用户快速查询数据的一种数据结构.类似于字典中的目录,查找字典内容时可以根据目录查找到数据的存放位 ...
- 虚拟机VMware安Mac OS时没有Apple mac选项
相信大家很多人在虚拟机安装mac os时候发现在选择客户机操作系统时候,没有Apple mac os选项,这样就会导致无法进行下一步,下面我来给大家详细介绍怎么添加这一项. 1.首先安装unlocke ...
- MapReduce 使用案例
MapReduce 使用案例 MapReduce在面试过程中出现的频率还是挺高的,尤其是数据挖掘等岗位.通常面试官会出一个大数据题目,需要被试者根据题目设计基于MapReduce的算法来解答.我在一个 ...
- redis 集群分配哈希曹
重新分配哈希曹: ip:port 为当前redis集群任意节点ip和port redis-cli --cluster reshard ip:port 操作如图: 分配哈希槽有两种方式: 1.在其他节点 ...
- oracle中用rownum分页并排序的查询SQL语句
oracle的sql语句中没有limit,limit是mysql中特有的,在oracle中可用rownum来表示,用于查询结果中的前N行数据. 如要查询emp表中的前5行数据,可用如下语句: sele ...
- Struts2 改变语言状态
只要在请求中增加 request_locale=en_US 参数,就可以实现语言的切换,内部由拦截器实现
- BZOJ 1497 最大获利(最大权闭合图)
1497: [NOI2006]最大获利 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 4686 Solved: 2295 [Submit][Statu ...