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

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

高精度乘法 问了下晖哥ICPC比赛时可以用多种语言混合提交 这里就给出Java的写法 建议掌握Java的大数类

C++的版本自己感兴趣的自己去敲一敲好了 把小数点去掉乘法最后加上小数点就好了

import java.math.BigDecimal;
import java.util.Scanner; public class Main {
public static void main(String[] args) {
@SuppressWarnings("resource")
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);
}
}
}

【PKU1001】Exponentiation(高精度乘法)的更多相关文章

  1. 【POJ 1001】Exponentiation (高精度乘法+快速幂)

    BUPT2017 wintertraining(15) #6A 题意 求\(R^n\) ( 0.0 < R < 99.999 )(0 < n <= 25) 题解 将R用字符串读 ...

  2. [vijos P1040] 高精度乘法

    如果这次noip没考好,完全是因为从7月29日之后就没有再写过程序了.说起来,真是一个泪流满面的事实… 那这样一个弱智题练手恢复代码能力,竟然还花了我两个晚上(当然不是两整个晚上…) 第一天TLE了, ...

  3. hdu 1042 N!(高精度乘法 + 缩进)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1042 题目大意:求n!, n 的上限是10000. 解题思路:高精度乘法 , 因为数据量比较大, 所以 ...

  4. hdu 1042 N!(高精度乘法)

    Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N!   Input One N in ...

  5. 1001. Exponentiation高精度运算总结

    解题思路 这道题属于高精度乘法运算,要求输入一个实数R一个指数N,求实数R的N次方,由于R有5个数位,而N又特别大,因此用C++自带的数据类型放不下. 解题思路是通过数组储存每次乘积结果和底数的每一位 ...

  6. Vijos 1040 高精度乘法

    描述 高精度乘法 输入:两行,每行表示一个非负整数(不超过10000位) 输出:两数的乘积. 样例1 样例输入1 99 101 样例输出1 9999 题解 这道题和之前的Vijos 1010 清帝之惑 ...

  7. [leetcode]43. Multiply Strings高精度乘法

    Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and ...

  8. H. GSS and Simple Math Problem 高精度乘法模板

    链接:https://www.nowcoder.com/acm/contest/104/G来源:牛客网 题目描述 Given n positive integers , your task is to ...

  9. 高精度乘法--C++

    高精度乘法--C++ 模仿竖式乘法,在第一步计算的时候将进位保留,第一步计算完再处理进位.(见代码注释) 若要处理正负情况,可在数据输入后加以判断,处理比较简单. 小数计算也可参照该方法,不过对齐方式 ...

随机推荐

  1. Android系统文件夹组织结构

  2. 将excel文件批量转成pdf

    防止数据编辑.改动带来的不一致性,常常要将excel文件转成pdf文件再共享.发送给对方.有时excel文件还挺多,手头上保存实在是太慢了.就考虑用VBA批量转置. 掌握几个东西,就比较容易了: 1. ...

  3. 好文mark

    用oracle的dblink连接mysql. http://f.dataguru.cn/thread-267150-1-1.html hadoop的机架感知: 本地化策略,以及备份都要知道哪个节点在哪 ...

  4. 【转】Sqlite 混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该...

    开发环境: vs2010+.net framework 4.0+ System.Data.SQLite.DLL (2.0)今天在做Sqlite数据库测试,一运行程序在一处方法调用时报出了一个异常 混合 ...

  5. BZOJ 1668 馅饼里的财富

    RT. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> ...

  6. jython安装

    下载了jython后:http://www.cr173.com/soft/9719.html 这是我当时下载的网站 官网很慢开始->运行->cmd->打开dos命令窗口,转到jyth ...

  7. Draw_extend使用OpenGL显示数据点

    //alter load_map.dev //safety verion 2016/1/12 #include <iostream> #include <fstream> #i ...

  8. 【转】Native JavaScript Data-Binding

    原文转自:http://www.sellarafaeli.com/blog/native_javascript_data_binding Two-way data-binding is such an ...

  9. 用HTML和CSS实现WWDC 2015上的动画效果

    用HTML和CSS实现WWDC 2015上的动画效果 动画效果WWDC 2015   原文:https://cssanimation.rocks/wwdc15/ 译者:周晓楷(@Helkyle) 每年 ...

  10. 和efast对接

    (1)    efast加入白名单 (2)    外网环境对接外网环境 内网环境对接内网环境 (3)    使用拉取的数据下单 才能同步到efast 4 档案同步 数据库 sys_ishop_sync ...