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

好像J2SE 1.4里的BigDecimal没有pow方法的吧…………

Posted by FinalLaugh at 2004-09-14 19:29:52 on Problem 1001
In Reply To:新手上路:请问为什么Compile Error? (附Java源程序) Posted by:neoedmund at 2004-09-14 10:37:37
> 
> import java.io.BufferedReader;
> import java.io.IOException;
> import java.io.InputStreamReader;
> import java.math.BigDecimal;
> import java.util.StringTokenizer;
> 
> public class Main {
> 
>     public static void main(String[] args) throws IOException {
>         BufferedReader stdin = new BufferedReader(new InputStreamReader(
>                 System.in));
> 
>         String line;
>         while ((line = stdin.readLine()) != null) {
>             StringTokenizer st = new StringTokenizer(line);
>             BigDecimal v = new BigDecimal(st.nextToken());
>             int n = Integer.parseInt(st.nextToken());
>             System.out.println(getResult(v, n));
>         }
> 
>     }
> 
>     /**
>      * @param v
>      * @param n
>      * @return
>      */
>     private static Object getResult(BigDecimal v, int n) {
>         return v.pow(n).toString();
>     }
> }

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