Skip to content

Instantly share code, notes, and snippets.

@biscuitehh
Created August 9, 2012 05:48
Show Gist options
  • Save biscuitehh/3301440 to your computer and use it in GitHub Desktop.
Save biscuitehh/3301440 to your computer and use it in GitHub Desktop.
Java Example
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