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. [大数据相关] Hive中的全排序:order by,sort by, distribute by

    写mapreduce程序时,如果reduce个数>1,想要实现全排序需要控制好map的输出,详见Hadoop简单实现全排序. 现在学了hive,写sql大家都很熟悉,如果一个order by解决 ...

  2. CentOS 7 安装MySQL8

    安装 下载Linux对应的MySQL https://dev.mysql.com/downloads/mysql/ CentOS选择Red Hat Enterprise Linux 在/usr/loc ...

  3. qt Qt5开发

    本章将介绍使用Qt5开发.我们将告诉你如何安装Qt SDK,如何使用Qt Creator IDE创建以及运行一个简单的Hello World应用程序. 一.安装Qt5 SDK Qt SDK包括构建桌面 ...

  4. 006-多线程-集合-Set-ConcurrentSkipListSet

    一.简介 ConcurrentSkipListSet是线程安全的有序的集合,适用于高并发的场景.ConcurrentSkipListSet和TreeSet,它们虽然都是有序的集合.但是,第一,它们的线 ...

  5. 26Flutter 日期 和时间戳/格式化日期库/flutter异步/ 官方自带日期组件showDatePicker、时间组件showTimePicker以及国际化

    /* 一.Flutter日期和时间戳 日期转换成时间戳 var now=newDateTime.now(); print(now.millisecondsSinceEpoch); //单位毫秒,13位 ...

  6. React vs. Angular vs. Vue

    原文连接 历史 React是一个用于构建Web应用程序UI组件的JavaScript库. React由Facebook维护,许多领先的科技品牌在其开发环境中使用React. React被Faceboo ...

  7. MySQL之二进制日志

    一.Binlog日志格式 根据日志定义的格式不一样,可以分为Statement格式.Row格式或者MIXED格式 mysql5.6----> | binlog_format | STATEMEN ...

  8. 123457123457#0#-----com.threeapp.PaoPaoLong01-----泡泡龙大作战01

    com.threeapp.PaoPaoLong01-----泡泡龙大作战01

  9. Jsoup-简单爬取知乎推荐页面(附:get_agent())

    总览 今天我们就来小用一下Jsoup,从一个整体的角度来看一看爬虫 一个基本的爬虫框架包括: [x] 解析网页 [x] 失败重试 [x] 抓取内容保存至本地 [x] 多线程抓取 *** 分模块讲解 将 ...

  10. (二)Centos之在VM虚拟机中安装Centos操作系统

    一.下载 阿里云镜像 https://mirrors.aliyun.com/centos/7/isos/x86_64/ 下载那个 DVD版本即可. 二.安装 在安装操作系统之前 我们来给这个“机器”搞 ...