A == B ?
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 91202 Accepted Submission(s): 14548
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
Author
8600 && xhd
Source
Recommend
linle | We have carefully selected several similar problems for you: 2072 2052 2055 2053 2057
Statistic | Submit | Discuss | Note
java大数真是开挂般的存在啊
如果用c做的话 不要忘记00005=5,0.5000=0.5
import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sca=new Scanner(System.in); while(sca.hasNext()){ BigDecimal a=sca.nextBigDecimal(); BigDecimal b=sca.nextBigDecimal(); String num1=a.stripTrailingZeros().toString(); String num2=b.stripTrailingZeros().toString(); if(num1.equals(num2)){ System.out.println("YES"); } else{ System.out.println("NO"); } } sca.close(); } }
时间: 2024-10-10 16:46:39