Created
August 9, 2012 05:48
-
-
Save biscuitehh/3301440 to your computer and use it in GitHub Desktop.
Java Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Problem1001ReverseRoot | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner in = new Scanner(System.in); | |
double[] roots = new double[131072]; | |
// Get our input | |
int i = 0; | |
while(in.hasNextDouble()) | |
{ | |
roots[i] = in.nextDouble(); | |
i++; | |
} | |
while(i > 0) | |
{ | |
// Note: This output is a dirty hack, but much faster than anything else | |
System.out.println((double)Math.round(Math.sqrt(roots[i-1]) * 10000) / 10000); | |
i--; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment