Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool hasTriangles(double arr1[],double arr2[], double arr3[], int n)
  6. {
  7.     for (int i = 0; i < n; i++)
  8.     {
  9.         for (int j = 0; j < n; j++)
  10.         {
  11.             for (int r = 0; r < n; r++)
  12.             {
  13.                 if(arr1[i] > arr2[j] && arr1[i] > arr3[r])
  14.                 {
  15.                     if(arr1[i]*arr1[i] == arr2[j]*arr2[j] + arr3[r]*arr3[r])
  16.                     {
  17.                         return 1;
  18.                     }
  19.                 }else if(arr2[j] > arr1[i] && arr2[j] > arr3[r])
  20.                 {
  21.                     if(arr2[j]*arr2[j] == arr1[i]*arr1[i]+ arr3[r]*arr3[r])
  22.                     {
  23.                         return 1;
  24.                     }
  25.                 }else if(arr3[r] > arr1[i] && arr3[r] > arr2[j])
  26.                 {
  27.                     if(arr3[r]*arr3[r] == arr1[i]*arr1[i]+ arr2[j]*arr2[j])
  28.                     {
  29.                         return 1;
  30.                     }
  31.                 }
  32.             }
  33.         }
  34.     }
  35.     return 0;
  36. }
  37.  
  38. int main()
  39. {
  40.     int n;
  41.     cin >> n;
  42.     double arr1[100] = {1, 5, 3};
  43.     double arr2[100] = {2, 4};
  44.     double arr3[100] = {6, 3, 0};
  45.  
  46.     cout << hasTriangles(arr1, arr2, arr3, n);
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement