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比C++简单多了

Posted by dengyaolong at 2013-03-20 16:40:46 on Problem 1001
import java.util.*;
import java.math.*;
class Main{
public static void main(String []args){
BigDecimal a;
int b;
Scanner cin=new Scanner(System.in);

while(cin.hasNext()){
a=cin.nextBigDecimal();
b=cin.nextInt();
String s=a.pow(b).toPlainString();
//去掉后面的零
int q=s.length()-1;
while(s.charAt(q)=='0')q--;
if(s.charAt(q)=='.')q--;
//去掉前面的0
int p=0;
while(s.charAt(p)=='0')p++;
for(int i=p;i<=q;i++){
System.out.print(s.charAt(i));}
System.out.println();
}
}
}

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