Problem Description
Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many computer systems.




This problem requires that you write a program to compute the exact value of Rn where R is a real number ( 0.0 < R < 99.999 ) and n is an integer such that 0 < n <= 25.

 
Input
The input will consist of a set of pairs of values for R and n. The R value will occupy columns 1 through 6, and the n value will be in columns 8 and 9.
 
Output
The output will consist of one line for each line of input giving the exact value of R^n. Leading zeros should be suppressed in the output. Insignificant trailing zeros must not be printed. Don't print the decimal point if the result
is an integer.
 
Sample Input
95.123 12
0.4321 20
5.1234 15
6.7592 9
98.999 10
1.0100 12
 
Sample Output
548815620517731830194541.899025343415715973535967221869852721
.00000005148554641076956121994511276767154838481760200726351203835429763013462401
43992025569.928573701266488041146654993318703707511666295476720493953024
29448126.764121021618164430206909037173276672
90429072743629540498.107596019456651774561044010001
1.126825030131969720661201 要求的是一个大数a的n次方 只是还有几个条件。比方例二。小数点前为0要删除。
代码:
import java.math.BigDecimal;
import java.util.Scanner;
public class Main{
public static void main(String[] srgs)
{
Scanner cin =new Scanner(System.in);
BigDecimal a,s;
int i,n;
while(cin.hasNext())
{
a=cin.nextBigDecimal();
n=cin.nextInt();
s=a;
for(i=1;i<n;i++)
s=s.multiply(a);
s=s.stripTrailingZeros(); //去掉末尾所以的0
String ss=s.toPlainString(); //不准用科学计数的形式输出(e)。
if(ss.charAt(0)=='0') //推断ss第0位是否为0
{
ss=ss.substring(1); //从第一位截取
}
System.out.println(ss);
}
}
}

hdu 1063 Exponentiation 大数的更多相关文章

  1. hdu 1063 Exponentiation (高精度小数乘法)

    //大数继续,额,要吐了. Problem Description Problems involving the computation of exact values of very large m ...

  2. hdu 1063 Exponentiation

    求实数的幂,这个用C++写的话有点长,但是用Java写就非常方便了…… );            System.out.println(an);        }    }}

  3. HDU Exponentiation 1063 Java大数题解

    Exponentiation Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

  4. HDU ACM 1063 Exponentiation 大实数乘方

    分析:大实数乘方计算. #include<iostream> #include<string> using namespace std; struct BigReal //高精 ...

  5. hdu 1063(java写高精度)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1063 思路:最近刚学了java,然后就迫不及待想试试java写大数的好处了,呵呵,果然是很方便啊! i ...

  6. HDU 5047 Sawtooth(大数模拟)上海赛区网赛1006

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5047 解题报告:问一个“M”型可以把一个矩形的平面最多分割成多少块. 输入是有n个“M",现 ...

  7. [POJ] #1001# Exponentiation : 大数乘法

    一. 题目 Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 156373   Accepted: ...

  8. HDU 1715 (大数相加,斐波拉契数列)

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1715 大菲波数 Time Limit: 1000/1000 MS (Java/Others)     ...

  9. hdu 5718(Oracle)大数加法

    曾经有一位国王,统治着一片未名之地.他膝下有三个女儿. 三个女儿中最年轻漂亮的当属Psyche.她的父亲不确定她未来的命运,于是他来到Delphi神庙求神谕. 神谕可以看作一个不含前导零的正整数n n ...

随机推荐

  1. 在Windows下编译OpenSSL(VS2005和VC6)

    需要说明的是请一定安装openssl-0.9.8a .  openssl-1.0.0我没有编译成功. 如何在Windows下编译OpenSSL (Vs2005使用Vc8的cl编译器)1.安装Activ ...

  2. ActiveMQ持久化方式(转)

    消息持久性对于可靠消息传递来说应该是一种比较好的方法,有了消息持久化,即使发送者和接受者不是同时在线或者消息中心在发送者发送消息后宕机了,在消息 中心重新启动后仍然可以将消息发送出去,如果把这种持久化 ...

  3. js ajax调用请求

    <pre name="code" class="html"> function getAppList(env){ var data = {}; da ...

  4. [置顶] Java 8全面解析!不知道的来看看那!

    java8的面世惊动了不少业界人员,让我们一起来看看吧! 函数式接口 函数式接口是只定义了一个抽象方法的接口.Java 8引入了FunctionalInterface注解来表明一个接口打算成为一个函数 ...

  5. 杂题_POJ上的过桥问题

    本文出自:http://blog.csdn.net/svitter 过桥问题解释:一条船能够坐两个人,可是有非常多人要过河,所以送过一个人去,还有一个人还要回来接.使全部人过河之后时间最短,怎样求? ...

  6. OnClientClick和OnClick

    OnClientClick是客户端事件处理方法,一般采用JavaScript来进行处理,也就是直接在IE端运行,一点击就运行 OnClick是服务器端事件处理函数,使用C#或者vb.net,在服务器端 ...

  7. asp.net2.0安全性(1)--用户角色篇(起篇)--转载来自车老师

    安全管理的解决方案在.net1.1中几乎为一片空白,对于应用程序的验证与授权大部分的工作是开发人员自己编写代码,或者是借助企业库等工具来实现,此可谓.net1.1中的一大缺憾.在.net2.0中微软为 ...

  8. ASP.NET - Eval数据绑定

    <!--新闻分类--> <div id ="category" class ="Frm"> <h4>新闻分类</h4& ...

  9. How to decompile class file in Java and Eclipse - Javap command example(转)

    Ability to decompile a Java class file is quite helpful for any Java developer who wants to look int ...

  10. BZOJ 3110([Zjoi2013]K大数查询-区间第k大[段修改,在线]-树状数组套函数式线段树)

    3110: [Zjoi2013]K大数查询 Time Limit: 20 Sec   Memory Limit: 512 MB Submit: 418   Solved: 235 [ Submit][ ...