Problem descriptiongive You both numbers A and B, if A is equal to B, you should print "YES", or print "NO". Inputeach test case contains-numbers a and B. Outputfor each case, if A was equal to B, you should print "YES", or Prin T "NO". Sample INPUT1 2 2 2 3 3 4 3 Sample Output
NO
YES
YES
NO
This problem should take into account decimal, large number, 0050,50 and so on these cases in C or C + + will be more troublesome
But having Bigdeimal in Java just solves this problem (ACM can be submitted in Java)
The code is as follows:
Import Java.util.*;import Java.math.bigdecimal;public class main{public static void Main (String args[]) { BigDecimal A, b; Scanner in=new Scanner (system.in); while (In.hasnextbigdecimal ()) { a=in.nextbigdecimal (); b=in.nextbigdecimal (); if (A.compareto (b) ==0) System.out.println ("YES"); Else System.out.println ("NO");}}}
HDOJ_ACM 2054 using Java