poj 1003 高精度乘法

 无聊水水题。

 发现水题也不水,我勒了去.... 

import java.math.*;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner( System.in );
        BigDecimal R, c; 
        int n; 
        while( cin.hasNext() )
        {
            R = cin.nextBigDecimal();
            n = cin.nextInt();
            c = R.pow(n);
            String str = c.toPlainString();   //原样转换,从而不会显示科学计数法
            int x = 0, y = str.length()-1;
            while( str.charAt(x) == '0' ) x++;  // 处理前导,后导0
            while( str.charAt(y) == '0' ) y--;
            if( str.charAt(y) != '.' ) y++;
            System.out.println( str.substring(x,y) );
        }
    }
}
原文地址:https://www.cnblogs.com/yefeng1627/p/2844583.html