HDU 2054 A = B? [Java]

Source: Internet
Author: User
A = B?

Time Limit: 1000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 47896 accepted submission (s): 7324


Problem descriptiongive you two numbers A and B, if A is equal to B, you shoshould print "yes", or print "no ".


Inputeach test case contains two numbers A and B.


Outputfor each case, if A is equal to B, you shoshould print "yes", or print "no ".


Sample Input

1 22 23 34 3
 


Sample output

NOYESYESNO
 


Author8600 & xhd


Source celebration Cup warm up


Recommendlinle note: the amount is not easy to write in C, so it is really hard to figure out the pointer problem. Recently, the biginteger used in Java orz didn't take into account the decimal point issue. Direct wa, later, I changed it to string, which is similar to biginteger, and WA (data such as 2.10 and 2.100 cannot be replaced by string). Finally, I changed it to bigdecimal (equivalent to a floating point in C)
However, recently, I feel like I am a Java developer and a C ++ developer. I despise myself !!! I can't write data in C ++, but now it's just the time to lay the foundation ~~~ Java is such a powerful language, but it is used by me to toss these undesirable things. Apply
Java method. Although Java writes high precision and large data, it is imperative to use C ++ for AC.

Accepted 2054 250 ms 3800 K 374 B Java
import java.util.*;import java.math.*;public class Main {    public static void main(String args[]) {        BigDecimal a,b;        Scanner cin = new Scanner(System.in);        while(cin.hasNextBigDecimal()) {            a = cin.nextBigDecimal();            b = cin.nextBigDecimal();                        if(a.compareTo(b) == 0) System.out.println("YES");            else System.out.println("NO");                    }    }}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.