HDOJ 2054 A == B (精确大数相等)

原创 陈 浩翔  2016-01-27 04:47  阅读 55 次

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

import java.math.BigDecimal;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            BigDecimal A = sc.nextBigDecimal();
            BigDecimal B = sc.nextBigDecimal();

            if(A.compareTo(B)==0){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }

    }

}

anyShare分享到:
本文地址:http://chenhaoxiang.cn/2016/01/27/0447/
关注我们:请关注一下我们的微信公众号:扫描二维码会Java的公众号,公众号:程序编程之旅
版权声明:本文为原创文章,版权归 陈 浩翔 所有,欢迎分享本文,转载请保留出处!

发表评论


表情