HDU 2054 JAVA
2017-03-05 10:28
357 查看
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
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.math.BigInteger; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); BigDecimal a, b; while (in.hasNextBigDecimal()) { a = in.nextBigDecimal(); b = in.nextBigDecimal(); a = a.add(BigDecimal.ONE); b = b.add(BigDecimal.ONE); b = b.stripTrailingZeros(); a = a.stripTrailingZeros(); if (a.equals(b)) { System.out.println("YES"); } else { a = a.add(BigDecimal.ONE); b = b.add(BigDecimal.ONE); b = b.stripTrailingZeros(); a = a.stripTrailingZeros(); if (a.equals(b)) { System.out.println("YES"); } else{ System.out.println("NO"); } } } } }
相关文章推荐
- A == B_hdu_2054(很有意思).java
- hdu 2054 A == B ? (java大数)
- hdu 2054 A == B ?【JAVA】
- HDU-2054 A == B? Java
- hdu 2054 A == B ? (java大数)
- hdu 2054 A == B ? (java)
- hdu 2054 A == B ? (java)
- Java高精度练习 Hdu 1002+1042+1047+1212+1316+1715+1753+2054
- hdu 2054 A == B ? (java)
- 大数--HDU 2054 A==B?(java)
- hdu 2054 A == B ? (java)
- hdu 2054 A == B ?【JAVA】
- HDU-2054-A == B?(Java大数BigDecimal)
- HDU 2054 A == B ?(Java大数用equal???C模拟也不能错过)
- HDU_1055 && POJ_2054 Color a Tree(贪心)
- HDU-1715 大菲波数 Java
- HDU-1047 Integer Inquiry Java
- HDU 4002【高精度+欧拉函数+java】
- HDU高精度总结(java大数类)
- hdu java 大数 转载