题干:

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 R nwhere 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

C++while(cin>>s>>n){...}cwhile(scanf("%s%d",s,&n)==2) //to  see if the scanf read in as many items as you want/*while(scanf(%s%d",s,&n)!=EOF) //this also work    */{...}

题目大意:

输入a和b,其中a是小数,输出a的b次方的精确值。

解题报告:

直接上大数,别忘取后缀零。

AC代码:

import java.math.BigDecimal;
import java.util.Scanner;public class Main {public static void main(String[] args){Scanner in = new Scanner(System.in);while(in.hasNext()) {BigDecimal di = in.nextBigDecimal();int n = in.nextInt();di = di.pow(n);
//            System.out.println(di);String s = di.stripTrailingZeros().toPlainString();if(s.startsWith("0")) {s=s.substring(1);}System.out.println(s);}}
}

【POJ - 1001 】Exponentiation (Java大数,高精度)相关推荐

  1. POJ 1001 Exponentiation (记第一道Java水过的题)

    妹的!java些高精度相当与玩cs开外挂!电脑装上java很久了,一直只会写写a + b 玩,今天心血来潮找个高精度来玩玩.^ ^ import java.io.*; import java.util ...

  2. POJ 1001 Exponentiation

    最裸的高精度幂,记录一下Java里面高精度类的用法而已 1 import java.io.*; 2 import java.util.Scanner; 3 import java.math.*; 4 ...

  3. POJ 1001 Exponentiation

    题意:求c的n次幂--要求保留所有小数-- 解法:一开始只知道有BigInteger--java大数+模拟.第一次写java大数--各种报错各种exception--ORZ 没有前导0和小数后面的补位 ...

  4. poj 1001 Exponentiation(java)

    点击打开链接 Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 178771   Accepted: ...

  5. POJ 1001 Exponentiation C++解题报告 JAVA解题报告

    求高精度幂 Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 126980   Accepted: 30980 Descripti ...

  6. java北大oj1001_这个——北大 ACM POJ 1001 Exponentiation C/C++

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 帮忙看下 1.在自己电脑上测试没有问题,oj显示答案错误.提交的语言是c++. 2.这个代码哪里不符合C99标准,为什么不能使用C提交. -------- ...

  7. POJ PKU 2305 java大数进制转化 JAVA 大数转换成字符串 转

    题目描述: 给你两个n进制数a和b. 以n进制的形式输出a % b. 解题报告: String st = Integer.toString(num, base); // 把num当做10进制的数转成b ...

  8. (部分转载,部分原创)java大数类(2)

    NYOJ 773  开方数 http://acm.nyist.net/JudgeOnline/problem.php?pid=773 1 import java.util.Scanner; 2 3 p ...

  9. java大数输出一位小数_java大数练习 大明A+B(大数小数的高精度)

    title: java大数练习 大明A+B(大数小数的高精度) tags: [acm,杭电,大数] 题意 Problem Description 话说,经过了漫长的一个多月,小明已经成长了许多,所以他 ...

  10. [蓝桥杯][算法训练VIP]麦森数(Java大数+快速幂)

    题目描述 形如2p-1的素数称为麦森数,这时P一定也是个素数.但反过来不一定,即如果P是个素数,2p-1不一定也是素数.到1998年底,人们已找到了37个麦森数.最大的一个是P=3021377,它有9 ...

最新文章

  1. C语言——结构体链表,附完整示例
  2. 计算机科技英语论文,计算机专业英语(第2版)——科技交流与科技论文写作
  3. mysql in过大_项目中常用的 19 条 MySQL 优化
  4. c语言中if内函数值为零,C语言——if(0)之后的语句真的不会执行吗?
  5. java shopnc,ShopNC商城系统
  6. maven中filtering的使用
  7. python定时发送qq消息_自动给qq好友发消息
  8. Geometric GAN
  9. Linux搭建泰拉瑞亚(原版/模组/插件)服务器之1.4模组服务器
  10. 【数据结构】表达式建树
  11. python的数学建模库_数学建模库
  12. 零基础自学软件测试,第一份外包工作8K,到现在大厂月薪25K*16薪
  13. 应广单片机定时器TIME16配置
  14. 悲催的一级建造师成绩
  15. 计算机科学的创始人是谁,谁是计算机的父亲(两个)? . 谁是计算机科学的创始人?...
  16. php股东投资饼状图,百分比饼状图怎么做
  17. 强大!一键转换LaTex公式,这款开源公式识别神器比Mathpix Snip更适合你
  18. 学完物联网有哪些就业方向?
  19. 深入理解深度学习——正则化(Regularization):基础知识
  20. 拼多多pdd电商api接口

热门文章

  1. [Leedcode][JAVA][第680题][验证回文字符串Ⅱ][贪心][递归]
  2. [剑指offer]面试题第[48]题[Leetcode][JAVA][第3题][无重复字符的最长字串][滑动窗口][HashSet/Map]
  3. Schrödinger's Knapsack ZOJ - 4019 线性DP
  4. windows游戏编程_苹果的Mac和微软的Windows该如何选择?
  5. centos redis make 报错_Redis入门安装,你只需要看我写的这篇就行了
  6. 《C语言深度解剖》中的.c/.h 程序模板及函数注释风格
  7. 保存到数据库乱码mysql_Linux下MySQL保存进去数据为乱码的解决办法
  8. 韦东山 IMX6ULL和正点原子_GPIO和Pinctrl子系统的使用在100ASK_IMX6ULL上机实验
  9. 小米路由器怎么连接无盘服务器,播放器+服务器的方法瞬间玩转小米路由方法图文介绍...
  10. 解密ControlRotation与ActorRotation