• JAVA大数几算--HDU 2054 A == B ?


    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
     
    题意很简单,但是涉及到的位数非常多,其次是前导零,然后是精度的后导零,给组样例: 
    0000123.555  000000000000000000000123.55500000000000000000000000000000000000000000
     
    import java.math.BigDecimal;
    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    
    		Scanner cin = new Scanner(System.in);
    		while (cin.hasNext()) // 多组输入
    		{
    			BigDecimal a = cin.nextBigDecimal();
    			BigDecimal b = cin.nextBigDecimal();
    			if(a.compareTo(b)==0)System.out.println("YES");
    			else System.out.println("NO");
    			
    		}
    	}
    }
  • 相关阅读:
    docker学习
    获取程序所有加载的dll名称
    Microsoft.Exchange 发邮件
    EF实体对象解耦
    python并发与futures模块
    python协程
    python上下文管理器
    python迭代器与生成器
    python抽象基类
    python运算符重载
  • 原文地址:https://www.cnblogs.com/lunatic-talent/p/12798609.html
Copyright © 2020-2023  润新知