poj1001大数乘方java
来源:互联网 发布:淘宝推广渠道有哪些 编辑:程序博客网 时间:2024/05/14 04:11
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.
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 120.4321 205.1234 156.7592 998.999 101.0100 12
Sample Output
548815620517731830194541.899025343415715973535967221869852721.0000000514855464107695612199451127676715483848176020072635120383542976301346240143992025569.92857370126648804114665499331870370751166629547672049395302429448126.76412102161816443020690903717327667290429072743629540498.1075960194566517745610440100011.126825030131969720661201
import java.math.*;import java.util.*;class n{ public static void main(String[] args){ Scanner in=new Scanner(System.in); while(in.hasNext()){ BigDecimal val=in.nextBigDecimal(); int n=in.nextInt(); BigDecimal ret=val.pow(n).stripTrailingZeros(); System.out.println( ret.toPlainString().replaceAll("^0", "") ); } }}
//pow(); 乘方
//stripTrailingZeros 末尾除零
//toPlainString 防止高精度数使用科学计数法
//replaceAll("^0", "") 去掉前导零
- poj1001大数乘方java
- JAVA 处理 大数 POJ1001
- poj1001 java 大数
- java大数乘方,开方
- poj1001(java 大数处理)
- POJ1001 Exponentiation【高精度乘方】
- poj1001 大数的幂 java的用法
- 大数相关poj1001
- POJ1001大数相乘
- poj1001----大数乘法
- poj1001&大数乘法
- java实现RSA大数乘方取模运算
- poj1001 java
- Java --乘方
- 大数相乘(浮点数)poj1001
- 10万进制的大数乘方
- bnu1076 大数乘方 C语言版
- java高精度 poj1001
- Mysql数据库乱码与编码问题筛查
- MYSQL 主从服务器配置工作原理
- java排序之肆------归并排序代码
- 实用小命令-windows下查看端口占用情况
- poj 3405 Convex hull
- poj1001大数乘方java
- ACM大牛BLOG
- IOS中的本地通知和后台任务
- Android07
- HACMP切换启停DB2的脚本
- 比较一下numpy.math和Python标准库的math.sin的计算速度
- HDU4360:As long as Binbin loves Sangsang
- MongoDB的备份与恢复
- ajax学习