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. Android 开发环境之 VMware 虚拟机(android8.1)

    VM版本14 在官网下载androidx86的VMDK文件 官方下载地址 (VMDK文件是VMware的专用文件,比iso镜像文件安装要简便许多,内部已经配置好了,只需要按照虚拟机安装普通流程即可) ...

  2. 反应式微服务框架Flower

    Flower是一个构建在Akka上的反应式微服务框架,开发者只需要针对每一个细粒度的业务功能开发一个Service服务,并将这些Service按照业务流程进行可视化编排,即可得到一个反应式系统. 即时 ...

  3. SpringBoot Jar包瘦身 - 跟大文件说再见!

    前言 SpringBoot部署起来配置非常少,如果服务器部署在公司内网,上传速度还行,但是如果部署在公网(阿里云等云服务器上),部署起来实在头疼.就是 编译出来的 Jar 包很大,如果工程引入了许多开 ...

  4. Android | Sqlite3

    Android 数据库创建及使用: 创建: package he3.sd.dao; import android.content.Context; import android.database.sq ...

  5. python 字符串格式化format

    通过{}和:来代替传统%方式   1.位置参数 位置参数不受顺序约束,且可以为{},只要format里有相对应的参数值即可,参数索引从0开,传入位置参数列表可用*列表 >>> li ...

  6. SpringMVC学习笔记之---数据绑定

    SpringMVC数据绑定 一.基础配置 (1)pom.xml <dependencies> <dependency> <groupId>junit</gro ...

  7. MySQL多表(理论知识总结)

    1. 多表关系    外键    foreign key    添加外键语法:    alter table 表名1 add foreign key(外键名称) references 表名2(主键名称 ...

  8. android ——多线程编程

    1.定义一个线程只需要新建一个类继承自Thread.然后重写run()方法,并在里面编写耗时逻辑即可: class MyThread extends Thread{ public void run() ...

  9. lxml解析网页

    目录 1. 什么是lxml 2. 初次使用 3. xpath 3.2 标签定位 3.3 序列定位 3.4 轴定位 4. 实例 1. 什么是lxml lxml是干什么的?简单的说来,lxml是帮助我们解 ...

  10. monkey学习总结笔记

    一.什么是monkey? Monkey是Android中的一个命令行工具,可以运行在模拟器里或实际设备中.它向系统发送伪随机的用户事件流(如按键输入.触摸屏输入.手势输入等),实现对正在开发的应用程序 ...