首页 > 编程语言 > 详细

HDU-2054-A == B?(Java大数BigDecimal)

时间:2015-05-03 13:26:08      阅读:201      评论:0      收藏:0      [点我收藏+]

A == B ?

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 72556    Accepted Submission(s): 11427


Problem Description
Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO".
 

Input
each test case contains two numbers A and B.
 

Output
for each case, if A is equal to B, you should print "YES", or print "NO".
 

Sample Input
1 2 2 2 3 3 4 3
 

Sample Output
NO YES YES NO
 

Author
8600 && xhd
 

Source
 

Recommend
linle   |   We have carefully selected several similar problems for you:  2057 2050 1096 1091 2074 


比起c选手,只有在做大数的时候,有一种自然而然的优越感技术分享


import java.io.*;
import java.math.BigDecimal;
import java.util.*;

public class Main
{

	public static void main(String[] args)
	{
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
		while(input.hasNext())
		{
			BigDecimal a = input.nextBigDecimal();
			BigDecimal b = input.nextBigDecimal();
			if(a.compareTo(b)!=0)
			{
				System.out.println("NO");
			}
			else
			{
				System.out.println("YES");
			}
		}
	}

}


 

HDU-2054-A == B?(Java大数BigDecimal)

原文:http://blog.csdn.net/qq_16542775/article/details/45457439

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!