Skip to content

Instantly share code, notes, and snippets.

@MohamedTaha98
Created May 5, 2018 09:36
Show Gist options
  • Save MohamedTaha98/35dd68a919af29573dbcb3934ddd74ec to your computer and use it in GitHub Desktop.
Save MohamedTaha98/35dd68a919af29573dbcb3934ddd74ec to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
long L, S1, S2, Q;
cin >> L >> S1 >> S2;
cin >> Q;
for (int i = 0; i < Q; i++)
{
int q;
cin >> q;
double side = sqrt(q);
cout << sqrt(2 * pow(L - side, 2)) / abs(S1 - S2) << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment