无聊水水题。

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

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) );
        }
    }
}

 

相关文章:

  • 2021-06-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-10-19
猜你喜欢
  • 2022-12-23
  • 2021-09-30
  • 2021-10-25
相关资源
相似解决方案