Skip to content

Instantly share code, notes, and snippets.

@MohamedTaha98
Created May 5, 2018 09:37
Show Gist options
  • Save MohamedTaha98/702920bf89eb718b8f53493a5c4a3af6 to your computer and use it in GitHub Desktop.
Save MohamedTaha98/702920bf89eb718b8f53493a5c4a3af6 to your computer and use it in GitHub Desktop.
import java.util.*;
public class Psolving {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
long L = in.nextLong();
long S1 = in.nextLong();
long S2 = in.nextLong();
int Q = in.nextInt();
for (int i = 0; i < Q; i++) {
double q = in.nextDouble();
q = Math.sqrt(q);
System.out.println(Math.sqrt(2 * (L - q) * (L - q)) / Math.abs(S1 - S2));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment