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

Hint

If you don't know how to determine wheather encounted the end of input: 
s is a string and n is an integer 
import java.util.Scanner;
import java.math.*;
public class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
BigDecimal bd = new BigDecimal(sc.next());
BigDecimal result = bd.pow(sc.nextInt());
String s = result.stripTrailingZeros().toPlainString();
if(s.startsWith("0"))
s=s.substring(1);
System.out.println(s);
}
}
}

poj1001 Exponentiation的更多相关文章

  1. poj1001 Exponentiation【java大数】

    Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 183034   Accepted: 44062 ...

  2. POJ-1001 Exponentiation 高精度算法

    题目链接:https://cn.vjudge.net/problem/POJ-1001 以前写过一个高精度乘法,但是没有小数点,实现起来也没什么难得, 现在把代码都般过来,等会把旧电脑弄一弄,暂时就不 ...

  3. poj1001 Exponentiation 大数的幂

    Description Problems involving the computation of exact values of very large magnitude and precision ...

  4. POJ 1001 解题报告 高精度大整数乘法模版

    题目是POJ1001 Exponentiation  虽然是小数的幂 最终还是转化为大整数的乘法 这道题要考虑的边界情况比较多 做这道题的时候,我分析了 网上的两个解题报告,发现都有错误,说明OJ对于 ...

  5. poj1000-1009小结

    poj1000-1009小结 poj1000-1009小结 poj1000 AB poj1001 Exponentiation poj1002 poj1003 poj1004 Financial Ma ...

  6. 【poj1001】 Exponentiation

    http://poj.org/problem?id=1001 (题目链接) 题意 求实数R的n次方,要求高精度. Solution SB题Wa了一下午,直接蒯题解. 高精度,小数点以及去前导后导零很麻 ...

  7. Exponentiation POJ-1001

    http://poj.org/problem?id=1001 //10000000 100000 #include<iostream> #include<cstring> us ...

  8. 【PKU1001】Exponentiation(高精度乘法)

    Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 145642   Accepted: 35529 ...

  9. uva748 - Exponentiation

    import java.io.*; import java.text.*; import java.util.*; import java.math.*; public class Exponenti ...

随机推荐

  1. 46. Permutations

    题目: Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the fo ...

  2. Android scrollview嵌套listview运行后最先显示出来的位置不在顶部而是中间问题

    scrollview里面嵌套了一个listview ,通过设置一个方法设置了listview的高度 现在的情况就是进到这个界面的时候看到的不是最上面 而是中间 ,该问题的解决办法为: mScrollV ...

  3. 计算机技能get(windows系统)

    1.快速打开程序,比如计算器,注册表,先按win键(不用再按win+r啦),输入程序名字,如calc,regedit等,直接打开. 2.自动左右分屏,win+上下左右方向键,win+↑ 最大化,win ...

  4. epoll和poll效率差异

    http://blog.163.com/sky20081816@126/blog/static/164761023201073033517435/ 百度“epoll和poll”

  5. [Codeforces677C]Vanya and Label(组合数学,快速幂)

    题目链接:http://codeforces.com/contest/677/problem/C 题意:给一个字符和数字的映射关系,然后再给一个字符串.问有多少个其他的字符串,使得那些字符串之间相互操 ...

  6. ganglia对于tomcat进程的res内存监控扩展

    ganglia是采用yum的安装,因此安装相关内容路径可能不同,但是不影响插件的扩展编写: 本次介绍的扩展是采用python脚本进行扩展,因此监控节点上需要安装python的相关插件: sudo yu ...

  7. AI 状态机

    by AKara 2010-11-11 @ http://blog.csdn.net/akara @ akarachen(at)gmail.com @weibo.com/akaras 一个简单横版游戏 ...

  8. Android Broadcast Receiver

    说明 有时候我们在做android系统软件的时候,经常会需要做的事就是开机重新设置上次关机前的状态,当然,我们就会用到这个开机广播: <uses-permission android:name= ...

  9. 批量添加-fno-objc-arc

    http://syxiaqj.github.io/2014/02/28/bee-learning-1/ 4.批量添加-fno-objc-arc 因为BeeFramework是一个非RAC的框架,现在X ...

  10. 函数与关系实例,函数运算与SQL,试验与关系元组

    函数是一个集合,它的每个元素都是二元组或多元组.例如 f = { (x, y) | x∈R & y∈R & y = 2x } ,g = { (x, y, z) | (x, y, z)∈ ...