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 |
My solution has been rejudged from Accepted to Wrong Answer... Why..??Help me please, I don't understand why my solution is Wrong... Here is my code: /*************************************************** * Online Judge: Peking University * Problem: Finding Bovine Roots * Source: USACO 2005 December Bronze * Author: Camilo Andrés Varela León * Date: 2007-01-25 **/ import java.io.*; import java.util.*; class Main { public static void main(String args[]) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuffer buffer = new StringBuffer(); long l = new Long(in.readLine()); double fr = new Double(in.readLine()); fr /= Math.pow(10, l); double value = (double)1 / Math.pow(10, l + 2); double error = Double.MAX_VALUE; long nextLong = 0; int a = 1; while (error > value) { double aprox = 2 * Math.log10(a + fr); aprox = Math.pow(10, aprox); nextLong = (long)Math.ceil(aprox); double raiz = Math.sqrt(nextLong); error = Math.abs((raiz - (long)raiz) - fr) / 100; a ++; } System.out.println(nextLong); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator