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 }

最新文章

  1. JavaScript设计模式学习笔记
  2. Unity中使用多构造函数(转)
  3. LeetCode - Minimum Depth of Binary Tree
  4. springMVC-HelloWorld
  5. 畅通工程再续(MST)
  6. const C语言(转)
  7. Entity Framework 学习初级篇--EntityClient(转)
  8. accessor method & mutator method
  9. dubbo管理控制台安装和使用
  10. poj 1328 Radar Installation(贪心)
  11. 打印web页面指定区域的三种方法
  12. crawler_JVM_DNS_在爬虫中的应用
  13. OpenCV框架介绍
  14. Android: DrawerLayout 侧滑菜单栏
  15. 微信小程序,前端大梦想(八)
  16. 工作流程,编程,调试,性能:Unity游戏开发者应该学习的20个改进技巧
  17. iOS下JS与OC互相调用(八)--Cordova详解+实战
  18. 【转】sentry 实时事件日志聚合平台
  19. oracle常用系统函数
  20. MySQL实现按天统计数据的方法

热门文章

  1. usb gadge驱动设计之我是zero
  2. printf("\033[1;33m ***** \033[0m \n");
  3. Kubespray部署Kubernetes 1.13.0(使用本地镜像仓库)
  4. python双向链表的疑问(Question)
  5. java高级编程技巧
  6. 怕忘记-windows 2003服务器安装Node.js NPM
  7. WEBs
  8. 【Decode Ways】cpp
  9. leetcode 【 Reverse Nodes in k-Group 】 python 实现
  10. 【Remove Nth Node From End of List】cpp