"PKU1001" exponentiation (high precision multiplication)

Source: Internet
Author: User

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 are a taxing experience for many computer systems.

This problem requires so 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 a integer such that 0 < n <= 25.

Input

The input would consist of a set of pairs of values for R and N. The R value would occupy columns 1 through 6, and the N value would be in columns 8 and 9.

Output

The output would consist of one line for each line of input giving the exact value of r^n. Leading zeros should is suppress Ed in the output. Insignificant trailing zeros must not being printed. Don ' t print the decimal point if the result was an integer.

Sample Input

95.123 120.4321 205.1234 156.7592  998.999 101.0100 12

Sample Output

548815620517731830194541.899025343415715973535967221869852721.00000005148554641076956121994511276767154838481760200726351 20383542976301346240143992025569.92857370126648804114665499331870370751166629547672049395302429448126.7641210216181644302 0690903717327667290429072743629540498.1075960194566517745610440100011.126825030131969720661201

High-precision multiplication ask the next FAI ICPC competition can be mixed in a variety of languages submitted here is to give the Java writing suggestions to master the large number of Java class

C + + version of yourself interested to knock it all off the decimal point minus the multiplication and then the decimal point is good.

ImportJava.math.BigDecimal;ImportJava.util.Scanner; Public classMain { Public Static voidMain (string[] args) {@SuppressWarnings ("Resource") Scanner SC=NewScanner (system.in);  while(Sc.hasnext ()) {BigDecimal BD=NewBigDecimal (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 (high precision multiplication)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.