加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码网 (https://www.900php.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

hdu2054 A == B ? (大数)

发布时间:2021-01-24 05:17:03 所属栏目:大数据 来源:网络整理
导读: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

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,237); font-size:18px; font-family:Arial; font-weight:bold"> Sample Input
  
  
   
   1 2
2 2
3 3
4 3
  
  
?
Sample Output
  
  
   
   NO
YES
YES
NO
  
  
?
Author 8600 && xhd ?
Source 校庆杯Warm Up ?
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();
    }
}

(编辑:源码网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读