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

Re:这样写感觉完全没问题啊,但是就是不让过。。。。。

Posted by zhongxiangwei at 2014-12-06 13:06:37 on Problem 1001
In Reply To:这样写感觉完全没问题啊,但是就是不让过。。。。。 Posted by:724997498 at 2014-07-20 00:04:55
> import java.util.*;
> import java.math.*;
> public class Main {
> 	public static void main(String args[])
> 	{
> 		Scanner in=new Scanner(System.in);
> 		while(in.hasNext())
> 		{
> 			double a=cin.nextDouble();
> 			int b=cin.nextInt();
> 			BigDecimal num = new BigDecimal(a);
> 			BigDecimal result=num.pow(b);
> 			if(result.compareTo(result.setScale(0,BigDecimal.ROUND_FLOOR)) == 0) {
> 				   System.out.println(result.setScale(0, BigDecimal.ROUND_FLOOR));
> 			}
> 			else if(result.compareTo(BigDecimal.ONE) == -1){
> 				String s = result.toPlainString();
> 				System.out.println(s.replaceFirst("^0*", ""));
> 			}
> 			else {
> 				System.out.println(result.toPlainString());
> 			}
> 		}
> 	}
> }

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