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. tomcat server.xml配置文件 解析

      把服务拆分出来了.      前几天我也进行了拆分.可是当时服务起不来所以我想会不会有什么设置,使得这个服务在主机中只能启一个.然后我又找了一台服务器,也把代码放了进去.结果仿佛是我料想到的样子, ...

  2. 【C++】类型转换

    引言 C++风格的四种类型转换方法:static_cast.dynamic_cast.reinterpret_cast.const_cast. 欢迎来到 lovickie 的博客 http://www ...

  3. 《sed的流艺术之二》-linux命令五分钟系列之二十二

    本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket. 为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. ...

  4. 列表字体css

    white-space: nowrap; text-overflow: ellipsis; -o-text-overflow: ellipsis; overflow: hidden;

  5. 发测试邮件或垃圾邮件node脚本

    npm install nodemailer 执行后,指定目录下会出现node_modules模块,再相同目录下,创建main.js,js代码如下: var nodemailer = require( ...

  6. sqlserver access 多数据库操作

    今天搞了一天的事情, 更新 ACCESS 數據庫 ,要從  SQL SERVER 2008數據庫中  查詢資料.沒找到資料 只能自己做了. 首先查找一下 ,如何 用SQL  語句 select *   ...

  7. 第 13 章 装饰模式【Decorator Pattern】

    以下内容出自:<<24种设计模式介绍与6大设计原则>> Ladies and gentlemen,May I get your attention,Please?,Now I’ ...

  8. Win7系统Matlab2013a安装.m文件不自动关联到MATLAB.exe解决方法

    1.在matlab命令行中输入以下代码: cwd=pwd; cd([matlabroot '\toolbox\matlab\winfun\private']); fileassoc('add',{'. ...

  9. Code First 指定外键名称

    指定类外键有注释(DataAnnotation)和FluentAPI两种方式, 目前掌握的知识我们先把DataAnnotation可用的四种方式总结如下 第一种方法: //1-指定导航属性,会自动生成 ...

  10. 在ubuntu 10.04下编译ffmpeg

    最近准备研究ffmpeg-2.0.1. 那得先运行起来看看效果吧. 首先去官网下载源码: 然后 解压=> ./configure => make  OK . 1. 编译好后,发现没有ffp ...