WUSTOJ 1190: 零起点学算法97——A == B ?

Description

Give you two integer numbers A and B, if A is equal to B, you should print “YES”, or print “NO”.

Input

each test case contains two integer 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

HINT

注意A、B数位最多100位。

代码

/**
* 用时:472ms
* @author wowpH
* @version A1.1
* @date 2019年4月13日 下午9:35:04
*/ import java.math.BigInteger;
import java.util.Scanner; public class Main { private Scanner sc;
private BigInteger A, B; public Main() {
sc = new Scanner(System.in);
while(sc.hasNext()) {
A = sc.nextBigInteger();
B = sc.nextBigInteger();
if(A.equals(B)) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
sc.close();
} public static void main(String[] args) {
new Main();
} }

我为什么没有早点发现这个大数类(BigInteger),这么好用的一个类。

        虽然上面代码是正确的的,但是我想知道为什么下面这个就不行呢?

double 的表示范围是:1.7976931348623157e+308 这个为什么不行呢?

/**
* 提交:Wrong Answer
* @author wowpH
* @version A1.0
* @date 2019年4月13日 下午9:35:04
*/ import java.util.Scanner; public class Main { private Scanner sc;
private double A, B; public Main() {
sc = new Scanner(System.in);
while(sc.hasNext()) {
A = sc.nextDouble();
B = sc.nextDouble();
if(A == B) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
sc.close();
} public static void main(String[] args) {
new Main();
} }

1190: 零起点学算法97——A == B ?(Java)的更多相关文章

  1. Problem E: 零起点学算法97——进制转换

    #include<stdio.h> int main(){ ]; while(scanf("%d%d",&n,&r)!=EOF){ ,i=; ){ fl ...

  2. 1164: 零起点学算法71——C语言合法标识符(存在问题)

    1164: 零起点学算法71——C语言合法标识符 Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitted: 10 ...

  3. 1163: 零起点学算法70——Yes,I can!

    1163: 零起点学算法70--Yes,I can! Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitted: ...

  4. 1147: 零起点学算法54——Fibonacc

    1147: 零起点学算法54--Fibonacc Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitted: 20 ...

  5. 1145: 零起点学算法52——数组中删数II

    1145: 零起点学算法52--数组中删数II Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitted: 293 ...

  6. 1137: 零起点学算法44——多组测试数据输出II

    1137: 零起点学算法44--多组测试数据输出II Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitted: ...

  7. 1136: 零起点学算法43——多组测试数据输出I

    1136: 零起点学算法43--多组测试数据输出I Time Limit: 1 Sec  Memory Limit: 128 MB   64bit IO Format: %lldSubmitted: ...

  8. 1135: 零起点学算法42——多组测试数据(求和)IV

    1135: 零起点学算法42--多组测试数据(求和)IV Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitted ...

  9. 1134: 零起点学算法41——多组测试数据(a+b)III

    1134: 零起点学算法41--多组测试数据(a+b)III Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitt ...

随机推荐

  1. zabbix (11) 监控TCP连接数

    对TCP的监控可以采用ss.netstat./proc/net/tcp这三个不同的方案来实现.其中ss是最快的 (1)ss命令 [root@manager1 script_py ::]#time ss ...

  2. regasm注册com组件

    注意: regasm.exe在不同framework版本下的系统路径 一般存储的路径为:C:\Windows\Microsoft.NET\Framework\v2.0.50727\ 系统的版本不同,运 ...

  3. jquery获取html中当前元素对象,以及父对象,相邻的上一个对象,或下一个对象

    jsp代码: <span><input type="hidden" value="1" id="newInfo">& ...

  4. OpenJudge计算概论-分数求和

    /*====================================================== 1006:分数求和 总时间限制: 1000ms 内存限制: 65536kB 描述 输入 ...

  5. [原][OSG][osgEarth]osgEarth例子程序简介

    1.osgearth_graticule:生成经纬线. 2.osgearth_annotation:各类标注(点.线.面.模型.文本等). 3.osgearth_city:加载一个城市三维模型,可以浏 ...

  6. ISO/IEC 9899:2011 条款6.2.6——类型的表示

    6.2.6 类型的表示 6.2.6.1 通用类型 1.所有类型的表示都是未指定的,除了在本小节所描述的之外. 2.除了位域(bit-field),对象由连续的一个或多个字节序列构成,这些字节序列的字节 ...

  7. QML渐变色

    Rectangle { id: tab_btn width: height: parent.height color: "black" gradient: Gradient { G ...

  8. vue-cli 引入stylus报错

    在App.vue页面添加以下代码报错: <style lang="stylus" rel="stylesheet/stylus"> </sty ...

  9. 过滤emoji表情的方法

    public static function replaceEmoji($str) { $str = preg_replace_callback( '/./u', function (array $m ...

  10. 【Leetcode_easy】707. Design Linked List

    problem 707. Design Linked List 参考 1. Leetcode_easy_707. Design Linked List; 完