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

My solution has been rejudged from Accepted to Wrong Answer... Why..??

Posted by Steinersp at 2007-02-03 23:08:42 on Problem 3175
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:
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