码迷,mamicode.com
首页 > 其他好文 > 详细

hdu2054 A == B ? (大数)

时间:2016-08-14 22:21:08      阅读:203      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!