Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Java BigDecimal

Posted by LiningHoo at 2020-03-20 09:13:35 on Problem 1001 and last updated at 2020-03-20 09:14:31
import java.math.BigDecimal;
import java.util.*;


public class Main {
    public static void main(String[] args) throws InterruptedException {
        // write your code here
        Scanner cin = new Scanner(System.in);
        while(cin.hasNext()){
            BigDecimal a = cin.nextBigDecimal();
            int b = cin.nextInt();
            String res = a.pow(b).stripTrailingZeros().toPlainString();
            res = (res.indexOf("0.")==0)?(res.substring(1)):res;
            System.out.println(res);
        }
    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator