| ||||||||||
| 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 | |||||||||
Re:这种题我一般用Java,里面的类库能解决很多诡异问题,附AC代码In Reply To:这种题我一般用Java,里面的类库能解决很多诡异问题,附AC代码 Posted by:yzhw at 2010-01-27 00:07:54 > Source Code
>
> Problem: 1131 User: yzhw
> Memory: 3524K Time: 360MS
> Language: Java Result: Accepted
>
> Source Code
> import java.math.*;
> import java.io.*;
> import java.util.*;
> public class Main {
>
> /**
> * @param args the command line arguments
> */
> public static void main(String[] args) throws IOException{
> Scanner in=new Scanner(new BufferedReader(new InputStreamReader(System.in)));
> BigDecimal one=new BigDecimal(1),eig=new BigDecimal(8);
> String tmp;
> while(in.hasNext())
> {
> BigDecimal res=new BigDecimal(0);
> BigDecimal last=one.divide(eig);
> tmp=in.next();
> for(int i=2;i<tmp.length();i++)
> {
> res=res.add(last.multiply(new BigDecimal(tmp.charAt(i)-48)));
> last=last.divide(eig);
> }
> System.out.println(tmp+" [8] = "+res.toString()+" [10]");
> }
>
> }
>
> }
>
Good
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator