高精求小数幂

题意翻译

计算量非常大、精度要求非常高的问题是很常见的。举个例子,计算国家债务就是这么一项对于许多计算机系统来说非常繁重的工作。 现在有这么一个任务要求编写一个程序来计算R^n的精确值,其中R是一个实数(0.0 < R <= 9999.9)而n是一个整数(0 < n <= 250)。 输入将包含一个小于11行的文件,其中每一行包括一个R和一个n,中间用空格隔开(数量不定但是保证R的第一位在第一列而n的末位在第九列) 对于每一个输入需要有一行的输出,表示R^n的精确值。有三点要求: 1、输出不允许有前导0 2、不允许无意义的尾随0(如1.90中的0不能输出) 3、如果结果是整数,不应该打印小数点 如果你不知道如何确定输入的末尾值: 以下是一些帮助 string s; int n; c++版while(cin >> s >> n) {…这里是你的代码} c版while(scanf("%s%d",s,&n)==2) //以查看scanf是否按需要的数量读取。 {…这里是你的代码} 感谢 @SLYZ_0120 提供的翻译。

题目描述

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 <= 9999.9) and n is an integer such that 0 < n <= 250.

输入输出格式

输入格式


The input will consist of a set (less than 11) 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.

输出格式


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.

输入输出样例

输入样例 #1

95.123  2
0.4321  5
5.1234  7
6.7592  3
98.999  5
1.0100 10

输出样例 #1

9048.385129
.01506334182914325601
92663.3181348508776705891407804544
308.806114738688
9509420210.697891990494999
1.10462212541120451001

说明

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) { ... } c while(scanf("%s%d",s,&n)==2) //to see if the scanf read in as many items as you want { ... }