Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define x first
- #define y second
- using namespace std;
- void sayNo(int n){
- for (int i=0;i<n;i++){
- cout << "NO" << endl;
- }
- }
- float kos_pr(pair<float,float> p1, pair<float, float> p2, pair<float, float> p3){
- pair<float, float> v1;
- pair<float, float> v2;
- v1.x = p2.x-p1.x;
- v1.y = p2.y-p1.y;
- v2.x = p3.x-p1.x;
- v2.y = p3.y-p1.y;
- return v1.x*v2.y - v1.y*v2.x;
- }
- float sc_pr(pair<float,float> p1, pair<float, float> p2, pair<float, float> p3){
- pair<float, float> v1;
- pair<float, float> v2;
- v1.x = p2.x-p1.x;
- v1.y = p2.y-p1.y;
- v2.x = p3.x-p1.x;
- v2.y = p3.y-p1.y;
- return v1.x*v2.x + v1.y*v2.y;
- }
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- float k,b;
- pair<float, float> points[3];
- for (int i=0;i<3;i++){
- cin >> points[i].x;
- cin >> points[i].y;
- }
- k = (points[1].y - points[2].y)/(points[1].x - points[2].x);
- b = points[2].y - k * points[2].x;
- if (kos_pr(points[0],points[1],points[2])==0){
- cout << "YES" << endl;
- if (sc_pr(points[1], points[2], points[0]) >=0){
- cout << "YES" << endl;
- if (sc_pr(points[0], points[1], points[2]) <= 0){
- cout << "YES";
- }else{
- cout << "NO";
- }
- } else{
- sayNo(2);
- }
- }else{
- sayNo(3);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement