首页 > 其他 > 详细

hdu2054 A == B ? (大数)

时间:2016-08-14 22:20:41      阅读:163      评论:0      收藏:0      [点我收藏+]

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();
    }
}


hdu2054 A == B ? (大数)

原文:http://blog.csdn.net/su20145104009/article/details/52206305

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!