import java.io.*;
import java.text.*;
import java.util.*;
import java.math.*;
public class Exponentiation {
public static void main(String[] args){
Scanner sc = new Scanner(new BufferedInputStream(System.in));
BigDecimal bd1, ans;
DecimalFormat df = new DecimalFormat();
df.setMaximumFractionDigits(110); // 设置最大小数位
int n, i;
String st;
while(sc.hasNextLine()){
st = sc.nextLine();
String[] s = st.split(" +");
bd1 = new BigDecimal(s[0]);
n = Integer.parseInt(s[1].trim());
ans = new BigDecimal("1"); for(i = 1; i <= n; ++i){
ans = ans.multiply(bd1);
}
String result = df.format(ans); String[] str = result.split("\\."); /// '.' 要用 "\\."
//System.out.println(str[0]);
if(str[0].equals("0")){              /// 字符串判断相等 equals()             
System.out.println("." + str[1]);
}else{
result = result.replace(",",""); ///将结果中的','号去掉。。。
System.out.println(result);
}
//System.out.println(result);
}
sc.close();
}
}

uva 有时判题不给结果,我擦。。。

uva748 - Exponentiation的更多相关文章

  1. uva748 - Exponentiation 高精度小数的幂运算

    uva748 - Exponentiation   Exponentiation  Problems involving the computation of exact values of very ...

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

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

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

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

  4. Poj 1001 / OpenJudge 2951 Exponentiation

    1.链接地址: http://poj.org/problem?id=1001 http://bailian.openjudge.cn/practice/2951 2.题目: Exponentiatio ...

  5. POJ 1001 Exponentiation 无限大数的指数乘法 题解

    POJ做的非常好,本题就是要求一个无限位大的指数乘法结果. 要求基础:无限大数位相乘 额外要求:处理特殊情况的能力 -- 关键是考这个能力了. 所以本题的用例特别重要,再聪明的人也会疏忽某些用例的. ...

  6. HDU Exponentiation 1063 Java大数题解

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

  7. Problem F: Exponentiation

    Problem F: ExponentiationTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 4 Solved: 2[Submit][Status][W ...

  8. Exponentiation(java 大实数)

    http://acm.hdu.edu.cn/showproblem.php?pid=1063 Exponentiation Time Limit: 2000/500 MS (Java/Others)  ...

  9. ( 大数 startsWith substring) Exponentiation hdu1063

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

随机推荐

  1. java 小数点处理

    public class Test { public static void main(String[] args) { double i = 3.856; // 舍掉小数取整 System.out. ...

  2. entOS7安装iptables防火墙,试验未通过

    CentOS7默认的防火墙不是iptables,而是firewalle. 安装iptable iptable-service #先检查是否安装了iptables service iptables st ...

  3. orcad 元件库的查找位置对照表

    orcad元件库的查找: 如下:1.原理图常用库文件: MiscellaneousDevices.ddb: DallasMicroprocessor.ddb: IntelDatabooks.ddb: ...

  4. 最近360和adsafe软件有冲突

    360把adsafe自启动服务给关闭,所以每次启动都不能成功.

  5. C#学习笔记-----C#枚举中的位运算权限分配

    一.基础知识 什么是位运算? 用二进制来计算,1&2:这就是位运算,其实它是将0001与0010做位预算   得到的结果是 0011,也就是3  2.位预算有多少种?(我们就将几种我们权限中会 ...

  6. Jquery.Datatables 基本设置的中文注解

    $(document).ready(function() { $('#example').dataTable({ "sScrollX": "100%", //表 ...

  7. OID View

    http://oid-info.com/get/1.3.6.1.2.1.17.1.4.1.2

  8. wifi 4次握手

    转自:http://zhaoxiaobu.blog.51cto.com/878176/407130/ 不管是用WEP加密,还是用WPA,一般如果我们要和AP建立一个连接,要经过两个阶段认证(Authe ...

  9. 【php全局变量和静态变量、静态方法的使用方法】

    php全局变量使用关键字global声明,静态变量使用static声明,静态变量的使用可以使用 类名::变量名 示例代码: <?php //全局变量global 的用法和静态变量的使用 glob ...

  10. [LeetCode] Implement strStr()

    Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if need ...