C++中运算数超过浮点数位数怎样计算....

来源:百度知道 编辑:UC知道 时间:2024/05/31 15:45:22
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

用两个数组分别保存整数部分和小数部分,可以用每个元素表示一位,计算的时候对整个数组进行操作。
比如1234*4就是这样算的:
{1,2,3,4}*4={4,8,12,16}={4,8,13,6}={4,9,3,6}=4936