import java.io.*;
import java.math.BigInteger;
import java.util.*; public class Main {
public static void main(String[] args)
{
BigInteger ans,Zero; Zero = BigInteger.ZERO;
ans = BigInteger.ZERO;
Scanner cin = new Scanner(System.in);
while(cin.hasNextBigInteger())
{
BigInteger temp = cin.nextBigInteger();
if(temp.equals(Zero)) break;
ans = ans.add(temp);
}
System.out.println(ans);
}
}
import java.io.*;
import java.math.BigInteger;
import java.util.*; public class Main {
public static void main(String[] args)
{
BigInteger a,b; Scanner cin = new Scanner(System.in); while(cin.hasNextBigInteger())
{
a = cin.nextBigInteger();
b = cin.nextBigInteger();
System.out.println(a.multiply(b));
} }
}
import java.math.BigInteger;
import java.util.*; public class Main {
public static void main(String[] args)
{
BigInteger a,b,c;
String p,q;
Scanner cin = new Scanner(System.in); while(cin.hasNext())
{
p = cin.next();
String s = cin.next();
char ch = s.charAt(0);
q = cin.next(); System.out.println(p+" "+s+" "+q);
a = new BigInteger(p);
b = new BigInteger(q); if(ch == '+')
c = a.add(b);
else
c = a.multiply(b); if(a.bitLength() > 31)
{
System.out.println("first number too big");
}
if(b.bitLength() > 31)
{
System.out.println("second number too big");
}
if(c.bitLength() > 31)
{
System.out.println("result too big");
}
}
}
}

BigInteger Uva的更多相关文章

  1. uva 11357 Matches

    // uva 11357 Matches // // 题目大意: // // 给你n个火柴,用这n个火柴能表示的非负数有多少个,不能含有前导零 // // 解题思路: // // f[i] 表示正好用 ...

  2. UVa 10007 - Count the Trees(卡特兰数+阶乘+大数)

    题目链接:UVa 10007 题意:统计n个节点的二叉树的个数 1个节点形成的二叉树的形状个数为:1 2个节点形成的二叉树的形状个数为:2 3个节点形成的二叉树的形状个数为:5 4个节点形成的二叉树的 ...

  3. UVA 10254 十八 The Priest Mathematician

    The Priest Mathematician Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu ...

  4. UVa 11375 - Matches

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  5. BigInteger

    首先上模板(不断更新中...)(根据刘汝佳AOAPCII修改) #include <iostream> #include <sstream> #include <cstd ...

  6. uva 10007 Count the Trees

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  7. UVa 10213 - How Many Pieces of Land ?(欧拉公式)

    链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

  8. UVA 10328 - Coin Toss dp+大数

    题目链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_proble ...

  9. ACM中java中BigInteger和Decimal用到的主要函数

    java中大数以及高精度常用函数 使用java大数类解决问题时我们需要注意两个方面:1.不能有包名,也就是说我们要把主类放到默认的包里,如果你的代码里出现形如package cn.gov.test;这 ...

随机推荐

  1. python 自动化之路 day 08_2 网络编程

    本节内容 Socket介绍 Socket参数介绍 基本Socket实例 Socket实现多连接处理 通过Socket实现简单SSH 通过Socket实现文件传送 作业:开发一个支持多用户在线的FTP程 ...

  2. 高效线程池之无锁化实现(Linux C)

    from:http://blog.csdn.net/xhjcehust/article/details/45844901 笔者之前练手写过一个小的线程池版本(已上传至https://github.co ...

  3. 使用Map辅助拼装树状结构,消除递归调用

    目前菜单或其他树状结构在数据库中的存储,多数是以一个parentid作为关联字段,以一维形式存储.使用时全部查询出来,然后在内存中拼装成树状结构.现在主要涉及的是拼装方法的问题. 一般可以进行 递归调 ...

  4. Vim 中文件目录浏览插件——NERD tree

    说明 :vim的插件NERDTree用于使得vim窗口分左右窗口显示的用法说明.其中,左侧为目录的树形界面,简称为NERDTree界面,右则为vim界面. 一.配置步骤 下载地址: http://ww ...

  5. Windows下MySQL数据库备份脚本(一)

    说明: MySQL数据库安装目录:C:\Program Files\MySQL\MySQL Server 5.0 MySQL数据库存放目录:C:\Program Files\MySQL\MySQL S ...

  6. Python的面向对象1

    今天,我们来介绍Python的面向对象编程,其实面向对象并不陌生,在C++  ,Java  ,PHP中也有大量使用! 好了,我们来步入正题! 那什么是面向对象编程呢? 1. 面向对象编程是一种程序设计 ...

  7. VS2012 独占编辑 设置

    用VS2008建立的项目就有(禁止其他用户签出和签入) 为什么VS2012的项目就没有了呢??(管理员说他什么都没设置)VS2012: 两个项目同样是用VS2012打开的,而第一个是用VS2008创建 ...

  8. 理解Python的迭代器

    首先,廖雪峰老师的教程中解释了迭代器和生成器,这篇文章只是补充和我个人的总结. 什么是迭代 可以直接作用于for循环的对象统称为可迭代对象(Iterable). 可以被next()函数调用并不断返回下 ...

  9. JS身份证真实性校验(一)

    //这个可以验证15位和18位的身份证,并且包含生日和校验位的验证. //如果有兴趣,还可以加上身份证所在地的验证,就是前6位有些数字合法有些数字不合法. function isIdCardNo(nu ...

  10. 引用Excel时 未在本地计算机上注册ace.oledb.12.0

    可能由于未安装数据库补丁 下载地址http://download.microsoft.com/download/7/0/3/703ffbcb-dc0c-4e19-b0da-1463960fdcdb/A ...