Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
好像J2SE 1.4里的BigDecimal没有pow方法的吧…………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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator