Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. int x[3], n, i, j;
  6. scanf("%d", &n);
  7. double y[n], temp, p, q, r;
  8. for(i=0; i<n; i++)
  9. {
  10. for(j=0; j<3; j++)
  11. {
  12. scanf("%d", &x[j]);
  13. }
  14. y[i]= sqrt(pow(x[0],2) + pow(x[1], 2) + pow(x[2], 2));
  15. }
  16. for (i = 0; i<n; i++)
  17. {
  18. for (j = i+1; j<n; j++)
  19. {
  20. if (y[i] > y[j])
  21. {
  22. temp = y[i];
  23. y[i] = y[j];
  24. y[j] = temp;
  25. }
  26. }
  27. }
  28. p = pow(y[0], 2);
  29. q = pow(y[1], 2);
  30. r = pow(y[2], 2);
  31. if((p+q)==r)
  32. {
  33. printf("YES\n");
  34. }
  35. else
  36. {
  37. printf("NO\n");
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement