zoukankan      html  css  js  c++  java
  • HDUOJ

    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
    用C++写太麻烦了,需要考虑各种情况,前导零,后导零,正负数,整数小数。。。
    直接用java水过。。。
    import java.io.*;
    import java.math.*;
    import java.util.*;
    
    public class Main {
    
        public static void main(String[] args) {
            Scanner cin = new Scanner(System.in);
            BigDecimal x, y;
            while(cin.hasNextBigDecimal()){
                x = cin.nextBigDecimal().stripTrailingZeros();
                y = cin.nextBigDecimal().stripTrailingZeros();
                if(x.equals(y))
                    System.out.println("YES");
                else
                    System.out.println("NO");
            }
        }
    
    }
    


  • 相关阅读:
    centos 7 和 centoa 8的区别
    centos7制作U盘启动盘
    juypyter notebook安装
    Centos6安装MariaDB
    提job
    report a bug and update
    runtest提交job
    bug
    ps常用选项
    每日一句
  • 原文地址:https://www.cnblogs.com/kunsoft/p/5312757.html
Copyright © 2011-2022 走看看