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)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. java大数

    java大数还是很好用的! 基本加入: import java.math.BigInteger; import jave.math.BigDecimal; 分别是大数和大浮点数. 首先读入可以用: S ...

  5. JAVA大数运算

    java大数是个好东西,用起来方便,代码短. 代码如下: import java.util.*; import java.math.*; public class Main { public stat ...

  6. java大数总结【转】

    java大数(2013长春网络赛)--hdu4762总结一下:1.java提交类要写Main.2.读取大数. Scanner read=new Scanner(System.in); BigInteg ...

  7. HDU5047Sawtooth(java大数)

    HDU5047Sawtooth(java大数) 题目链接 题目大意:在一个矩形内画n个"M".问如何画可以把这个矩形分成最多的区域. 给出这个区域的数目. 解题思路:最好的方式就是 ...

  8. JAVA大数类

    JAVA大数类api http://man.ddvip.com/program/java_api_zh/java/math/BigInteger.html#method_summary 不仅仅只能查J ...

  9. HDU4762(JAVA大数)

    Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

随机推荐

  1. Linux系统属性文件详解

    1)inode概述 中文意思就是索引节点(index node)第一部分是inode 第二部分是block inode主要用来存放文件属性信息的(也就是ls - l 的结果)包含的属性信息包括文件的大 ...

  2. Git-GIt检出

    实际上在执行重置命令的时候没有使用任何参数对所要重置的分支名进行设置,这是因为重置命名实际上所针对的是头指针HEAD.之所以没有改变HEAD的内容是因为HEAD指向了一个引用refs/heads/ma ...

  3. TCP的运输连接管理

    TCP的运输连接管理 TCP是面向连接的协议,有三个阶段:连接建立.数据传送 和 连接释放.运输连接的管理就是使运输连接的简历和释放都能正常地进行. 在TCP连接建立过程中要解决一下三个问题: 1.  ...

  4. loj2051 「HNOI2016」序列

    ref #include <algorithm> #include <iostream> #include <cstdio> #include <cmath& ...

  5. 50、转自知乎上android开发相见恨晚的接口

      原文链接:http://www.zhihu.com/question/33636939     程序员软件开发Android 开发JavaAndroid修改 Android开发中,有哪些让你觉得相 ...

  6. CTF 两道web整数溢出题目(猫咪银行和ltshop)

    ①猫咪银行: (2018中科大hackgame) 一开始给十个CTB,而flag需要20个CTB,我们需要理财赚够20个. 理财是只能买入TDSU才可以获得收益.我们先上来直接把CTB全部换成TDSU ...

  7. hihoCoder #1809 : 本题数据范围五千

    Analysis (一) 猜想:答案跟 $q_1, q_2, q_3$ 无关:考虑排列 $q$ 是 $1, 2, 3$ 的情况,此时符合要求的排列 $p$ 实际上满足: 对于任意 $i < j ...

  8. 网络流 24 题汇总(LOJ 上只有 22 题???)

    太裸的我就不放代码了...(黑体字序号的题表示值得注意) 1.搭配飞行员 [LOJ#6000] 二分图最大匹配. 2.太空飞行计划 [LOJ#6001] 最小割常规套路.输出方案.(注:这题换行符要用 ...

  9. git - 搭建最简单的git server

    以下操作都在 centos7 下进行,但同样适用于centos 6. 1. 安装git-core yum -y install git 添加git用户,用于启动管理git仓库 useradd git ...

  10. photoshop 安装

    Photoshop 下载: http://www.duote.com/soft/54352.html 下载完后解压选择..\Adobe CS6\Set-up.exe ,点击  Set-up.exe   ...