Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <cstdio>
- #include <iomanip>
- #include <string>
- #include <vector>
- #include <map>
- #include <set>
- #include <stack>
- #include <queue>
- #include <algorithm>
- #include <cmath>
- typedef long long ll;
- using namespace std;
- void intersect(double a1, double a2, double b1, double b2, double c1, double c2, double& x, double& y)
- {
- double det = a1 * b2 - a2 * b1;
- x = (b1 * c2 - b2 * c1) / det;
- y = (a2 * c1 - a1 * c2) / det;
- }
- int main(){
- long double g = 10;
- long double k1,k2, a, y1, y2, y3, y4, x1, x2, x3, x4;
- long double x0, v,alth,a1,a2,b1,b2,c1,c2;
- cin >> v>> x0;
- cin >> x1 >> y1 >> x2 >> y2;
- cin >> x3 >> y3 >> x4 >> y4;
- alth = (asinl((x0 * 10) / (v*v))/2)*(180 / 3.14159265);
- if (alth < 45) {
- alth = 90 - alth;
- }
- double X, Y;
- a1 = y1 - y2;
- b1 = x2 - x1;
- c1 = x1 * y2 - x2 * y1;
- a2 = y3 - y4;
- b2 = x4 - x3;
- c2 = x3 * y4 - x4 * y3;
- intersect(a1, a2, b1, b2, c1, c2, X, Y);
- //cout << b1;
- if ((v*v) / ( g) < abs(x0)) {
- cout << "No";
- }
- else {
- if (X < 0||X>x0) {
- cout << "Yes";
- }
- else {
- if ((((-g) / (2 * v*v*cosl(alth*3.14159265 / 180.0)*cos(alth*3.14159265 / 180.0)))*X*X) + (tanl(alth*3.14159265 / 180.0)*X) <= Y) {
- cout << "No";
- }
- else {
- cout << "Yes";
- }
- }
- }
- //system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement