fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int check(int ar[])
  5. {
  6. if(ar[0] <= 0 || ar[1] <= 0 || ar[2] <= 0)
  7. return -1;
  8. //排序
  9. for(int i = 2 ; i > 0 ; i--)
  10. {
  11. for(int m = 0 ; m < i ; m++)
  12. {
  13. if(ar[m] > ar[m+1])
  14. {
  15. int tmp = ar[m];
  16. ar[m] = ar[m+1];
  17. ar[m+1] = tmp;
  18. }
  19. }
  20. }
  21. //比對(正0,直角1,其它2,非三角-1)
  22. if(ar[2] >= ar[0] + ar[1])
  23. return -1;
  24. else if((ar[2]^2) == (ar[0]^2) + (ar[1]^2))
  25. return 1;
  26. else if(ar[0] == ar[1] && ar[0] == ar[2])
  27. return 0;
  28. else
  29. return 2;
  30. }
  31.  
  32. int main() {
  33. int arr[3] = {0, 0, 0};
  34. cin >> arr[0] >> arr[1] >> arr[2];
  35. cout << check(arr) << endl;
  36. return 0;
  37. }
Success #stdin #stdout 0s 3300KB
stdin
Standard input is empty
stdout
-1