题目链接

 import java.util.*;
import java.math.*;
public class Main{ public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
while (cin.hasNext()) {
BigDecimal numa = cin.nextBigDecimal();
int numb = cin.nextInt();
String str = numa.pow(numb).stripTrailingZeros().toPlainString();
if (str.startsWith("0.")) {//如果开头是0.那么从小数点开始输出
System.out.println(str.substring(1));
} else {
System.out.println(str);
}
}
}
}

nyoj-155-求高精度幂(java大数)的更多相关文章

  1. 求高精度幂(java)

    求高精度幂 时间限制:3000 ms  |  内存限制:65535 KB 难度:2   描述 对数值很大.精度很高的数进行高精度计算是一类十分常见的问题.比如,对国债进行计算就是属于这类问题. 现在要 ...

  2. poj 1001 求高精度幂(Java, BigDecimal, pow, hasNext, stripTrailingZeros, toPlainString)

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

  3. Poj.Grids 2951 浮点数求高精度幂

    2951:浮点数求高精度幂 总时间限制: 1000ms 内存限制: 65536kB 描述 有一个实数 R ( 0.0 < R < 99.999 ) ,要求写程序精确计算 R 的 n 次方. ...

  4. 【ACM】求高精度幂

    题目来源:http://poj.org/problem?id=1001&lang=zh-CN 求高精度幂 Time Limit: 500MS   Memory Limit: 10000K To ...

  5. Exponentiation(求高精度幂)

    Exponentiation Time Limit: 500MS   Memory Limit: 10000K Total Submissions: 175340   Accepted: 42341 ...

  6. poj 1001 求高精度幂

    本题的测试用例十分刁钻,必须要考虑到很多的细节问题,在这里给出一组测试用例及运行结果: 95.123 12 548815620517731830194541.899025343415715973535 ...

  7. 求高精度幂(poj1001)

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

  8. HDU高精度总结(java大数类)

      HDU1002   A + B Problem II [题意]大数相加 [链接]http://acm.hdu.edu.cn/showproblem.php?pid=1002 Sample Inpu ...

  9. Java 大数、高精度模板

    介绍: java中用于操作大数的类主要有两个,一个是BigInteger,代表大整数类用于对大整数进行操作,另一个是BigDecimal,代表高精度类,用于对比较大或精度比较高的浮点型数据进行操作.因 ...

随机推荐

  1. 在eclipse中构建solr项目+添加core+整合mysql+添加中文分词器

    最近在研究solr,这里只记录一下eclipse中构建solr项目,添加core,整合mysql,添加中文分词器的过程. 版本信息:solr版本6.2.0+tomcat8+jdk1.8 推荐阅读:so ...

  2. 曾经跳过的坑----js截取字符串substr与substring 和 trim

    不废话直接代码.自己理解...... > "abcdefg".substring(1,6)> "bcdef"> "abcdefg&q ...

  3. 【转】Python爬虫_示例

    爬虫项目:爬取汽车之家新闻资讯   # requests+Beautifulsoup爬取汽车之家新闻 import requests from bs4 import BeautifulSoup res ...

  4. CentOS上快速安装saltstack

    查看当前centos版本号 cat /etc/redhat-release 查看内核版本 uname -r 主机 1.安装master(在第一台机器上安装master) 执行: wget -O /et ...

  5. vlc做转发的命令

    from:http://blog.csdn.net/linyuejiang/article/details/7498482 将一个udp的多播流转发复制到http流中去 vlc udp://@239. ...

  6. Centos小脚本(sftp)

    sftp用户创建,改变属组,家目录 #!/bin/python import os,sys class sftp_user(object): def __init__(self,user,passwd ...

  7. lelel-5

    一.样式有几种引入方式?link和@import有什么区别? 样式有3种引入方式: 外部样式(外联式Linking):是将网页链接到外部样式表<link rel="stylesheet ...

  8. PHP 最大化资源配置 Resource Limits 错误两则

    报错信息1:PHP Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 67108888 b ...

  9. iOS_AFNetWorking框架分析

    网络 — 你的程序离开了它就不能生存下去!苹果的Foundation framework中的NSURLConnection又非常难以理解, 不过这里有一个可以使用的替代品:AFNetworking.A ...

  10. C++字符串操作库函数

    #include <bits/stdc++.h> using namespace std; int main() { ]="; ]="abcdefg"; ]= ...