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,里面的类库能解决很多诡异问题,附AC代码

Posted by yzhw at 2010-01-27 00:07:54 on Problem 1131
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]");
        }

    }

}


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