Advertisement
Riposati

Untitled

Jun 15th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int x1,y1,a,b,x2,y2,aux,aux2;
  8.     bool f = 0;
  9.  
  10.     cin>>x1>>y1>>x2>>y2>>a>>b;
  11.  
  12.     if(x1==x2 && y1==y2){
  13.  
  14.         printf("YES\n");
  15.     }else{
  16.  
  17.         x1 += a;
  18.         y1 += b;
  19.  
  20.         aux = x1;
  21.         aux2 = y1;
  22.  
  23.         if(aux==x2 && aux2==y2){
  24.             f = 1;
  25.         }
  26.  
  27.         else{ // testa o segundo
  28.  
  29.             aux = x1;
  30.             aux2 = y1;
  31.  
  32.             aux = a + aux;
  33.             aux2 = b - aux2;
  34.  
  35.             if(aux==x2 && aux2==y2){
  36.                 f = 1;
  37.             }
  38.  
  39.             else{ // testa o terceiro
  40.  
  41.                 aux = x1;
  42.                 aux2 = y1;
  43.  
  44.                 aux = a - aux;
  45.                 aux2 = b + aux2;
  46.  
  47.                 if(aux==x2 && aux2==y2){
  48.  
  49.                     f = 1;
  50.                 }
  51.  
  52.                 else{
  53.  
  54.                     aux = x1;
  55.                     aux2 = y1;
  56.  
  57.                     aux = a - aux;
  58.                     aux2 = b - aux2;
  59.  
  60.                     if(aux==x2 && aux2==y2){
  61.                         f = 1;
  62.                     }
  63.                 }
  64.             }
  65.         }
  66.  
  67.         if(f) // se chegou no tesouro
  68.             printf("YES\n");
  69.         else
  70.             printf("NO\n");
  71.     }
  72.     return 0;
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement