A+B for Input-Output Practice (III)

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 113961    Accepted Submission(s): 60127

Problem Description
Your task is to Calculate a + b.
 
Input
Input contains multiple test cases. Each test case contains a pair of integers a and b, one pair of integers per line. A test case containing 0 0 terminates the input and this test case is not to be processed.
 
Output
For each pair of input integers a and b you should output the sum of a and b in one line, and with one line of output for each line in input. 
 
Sample Input
1 5
10 20
0 0
 
Sample Output
6
30
 
Author
lcy
 

值得注意的是怎么判断一个大数是否等于一个数,以及怎么把一个数转化为大数形式,注意大数实质上就是字符串

import java.math.BigInteger;
import java.util.Scanner;
public class Main//注意刷题时的java格式
{
public static void main(String[] args)
{
BigInteger a,b,d;
String c = "0";
d = new BigInteger(c);//将c转化为大数形式,用d保存
Scanner in = new Scanner(System.in);
while(in.hasNextBigInteger())
{
a = in.nextBigInteger();
b = in.nextBigInteger();
if(a.compareTo(d) == 0 && b.compareTo(d) == 0 )//注意用一个大数类自带方法来判断两个大数是否相等
break;
System.out.println(a.add(b));
}
}
}

java hdu A+B for Input-Output Practice (III)的更多相关文章

  1. HDU 1091 A+B for Input-Output Practice (III)

    #include <cstdio> int main() { int a,b; while(scanf("%d%d",&a,&b)!=EOF) if ( ...

  2. 转载:回编译APK出错:java.nio.char set.MalformedInputException: Input length = 1

    使用APKtool回编译APK,出现错误如下:    Exception in thread "main" org.yaml.snakeyaml.error.YAMLExcepti ...

  3. PHP-FPM-failed to ptrace(PEEKDATA) pid 123: Input/output error

    If you're running PHP-FPM you can see these kind of errors in your PHP-FPM logs. $ tail -f php-fpm.l ...

  4. NFS挂载异常 mount.nfs: Input/output error

    [root@localhost ~]# vi /etc/exports #增加/nfs 192.168.10.132(rw,no_root_squash,no_all_squash,async) [r ...

  5. BIOS(Basic Input/Output System)是基本输入输出系统的简称

    BIOS(Basic Input/Output System)是基本输入输出系统的简称 介绍 操作系统老师说,平时面试学生或者毕业答辩的时候他都会问这个问题,可见这个问题对于计算机专业的学生来说是如此 ...

  6. read()、write()返回 Input/output error, Device or resource busy解决

    遇到的问题,通过I2C总线读.写(read.write)fs8816加密芯片,报错如下: read str failed,error= Input/output error! write str fa ...

  7. Angular 个人深究(三)【由Input&Output引起的】

    Angular 个人深究(三)[由Input&Output引起的] 注:最近项目在做别的事情,angular学习停滞了 1.Angular 中 @Input与@Output的使用 //test ...

  8. Docker 在转发端口时的这个错误Error starting userland proxy: mkdir /port/tcp:0.0.0.0:3306:tcp:172.17.0.2:3306: input/output error.

    from:https://www.v2ex.com/amp/t/463719 系统环境是 Windows 10 Pro,Docker 版本 18.03.1-ce,电脑开机之后第一次运行 docker ...

  9. java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder

    java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder 少导入了jdom.jar包. 下载地址:http://www.jdom.org/do ...

随机推荐

  1. Linux vim基本的使用方法

    一.vim 的三种模式 (1) 插入模式 在插入模式中,才能输入文字:要进入插入模式,可以按键 “i”:如果要进入插入模式时,直接切换到下一行,可以输入“o”: (2) 命令模式 在命令模式中,主要进 ...

  2. 从原理层面掌握@SessionAttribute的使用【一起学Spring MVC】

    每篇一句 不是你当上了火影大家就认可你,而是大家都认可你才能当上火影 前言 该注解顾名思义,作用是将Model中的属性同步到session会话当中,方便在下一次请求中使用(比如重定向场景~). 虽然说 ...

  3. Android PDA扫描枪广播接搜条码并使用

    在开发扫描枪扫码接收广播条码的时候,由于厂商如shit般的文档和对Anroid基础知识的缺失,走了一些弯路,以下是广播接收条码并使用的代码实现 : 1 : 动态注册广播 PDA扫描枪对扫码有强大支持, ...

  4. 利用MAVEN打包可运行jar包,包括依赖的第三方包

    转载自:http://bglmmz.iteye.com/blog/2058914 背景: 另一篇文章说了如何利用IDEA来打包,现在来说说如何利用MAVEN打包 目标:应用本身打成一个jar包,依赖的 ...

  5. APPCAN   版本控制SVN

      1.检出代码 checkout 常规的操作     appcan 中,在官网新建一个项目后,就会有一项目的svn 地址,而且已经是主干分支了,这个是项目的位移目录,不能再trunk目录同级创建分子 ...

  6. hadoop学习(一)----概念和整体架构

    程序员就得不停地学习啊,故步自封不能满足公司的业务发展啊!所以我们要有搞事情的精神.都说现在是大数据的时代,可以我们这些码农还在java的业务世界里面转悠呢.好不容易碰到一个可能会用到大数据技术的场景 ...

  7. GBK和UTF-8的区别

    我们这里将以最简单最容易理解的方式来描述GBK和UTF8的区别,以及它们分别是什么.   GBK编码:是指中国的中文字符,其它它包含了简体中文与繁体中文字符,另外还有一种字符“gb2312”,这种字符 ...

  8. Linux--shel的if判断语句--05

    if条件语句的使用格式: 1.单分支语句 if [ 条件 ];then 执行语句 fi 注意:[ 条件 ] :条件与中括号要用空格分割:下面的语句同理. 2.双分支语句 if [ 条件 ];then ...

  9. trec 2019 fair ranking track

    trec 2019 fair ranking track     最近实验室要求参加trec 2019新出的track:fair ranking track.这里整理一下该任务的思想和要求.这次tra ...

  10. ASP.NET Core MVC 之区域(Area)

    区域(Area)是一个 ASP.NET MVC 功能,用于将相关功能组织为一个单独的命名空间(用于路由)和文件结构(用于视图).使用区域通过向控制器和操作添加 一个路由参数(area)来创建用于路由目 ...