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 ...
随机推荐
- [Hdu1693]Eat the Trees(插头DP)
Description 题意:在n*m(1<=N, M<=11 )的矩阵中,有些格子有树,没有树的格子不能到达,找一条或多条回路,吃完所有的树,求有多少种方法. Solution 插头DP ...
- 2018年湘潭大学程序设计竞赛 E 吃货
题目描述 作为一个标准的吃货,mostshy又打算去联建商业街觅食了.混迹于商业街已久,mostshy已经知道了商业街的所有美食与其价格,而且他给每种美食都赋予了一个美味度,美味度越高表示他越喜爱这种 ...
- C#小知识点积累
1.sealed 修饰符 概念: C#提出了一个密封类(sealed class)的概念,帮助开发人员来解决这一问题. 密封类在声明中使用sealed 修饰符,这样就可以防止该类被其它类继承.如果试图 ...
- Python及其常用模块库下载及安装
一.Python下载:https://www.python.org/downloads/ 二.Python模块下载:http://www.lfd.uci.edu/~gohlke/pythonlibs/ ...
- Redis数据结构以及Strings型操作
Redis数据结构图: Strings型 <String key,String value>: keys * 查看所有key get 获取key的value值 append 向key对 ...
- service-worker实践
service-worker虽然已列入标准,但是支持的浏览器还是有限制,还有比较多的问题. 1. 生命周期 注册成功-------installing--------------> 安装成功(i ...
- 测试环境docker化(一)—基于ndp部署模式的docker基础镜像制作
本文来自网易云社区 作者:孙婷婷 背景 我所在测试项目组目前的测试环境只有一套,在项目版本迭代过程中,开发或产品偶尔会在测试环境进行数据校验,QA人数在不断增加,各个人员在负责不同模块工作时也会产生脏 ...
- 设计模式之第19章-中介者模式(Java实现)
设计模式之第19章-中介者模式(Java实现) “测试妹纸找你,你的代码出问题了.”“美工妹纸让你看看界面怎么样.”身为程序员总要和各种人打交道,但是如果再分为前端.后端工程师的话,那么关系就会错综复 ...
- plsql编程
ORACLE PL/SQL编程详解 SQL语言只是访问.操作数据库的语言,并不是一种具有流程控制的程序设计语言,而只有程序设计语言才能用于应用软件的开发.PL /SQL是一种高级数据库程序设计语言,该 ...
- Python-S9—Day85-ORM项目实战之forms组件以及Modelform补充、跨域请求及应用
01 forms组件补充1 02 forms组件补充2 03 ModelForm回顾 04 浏览器的历史 05 jsonop实现跨域请求 06 jsonop实现跨域请求2 07 jsonop实现跨域请 ...