fork download
  1. #include <cstdio>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. double x, y, z, t;
  8. scanf( "%lf %lf %lf", &x, &y, &z );
  9. t = max(x, max(y, z));
  10. //if the triangle exists
  11. if( x + y + z > 2*t )
  12. {
  13. //if it is acute
  14. double COS_VALUE = t*( x*x + y*y + z*z - 2*t*t ) / ( 2*x*y*z );
  15. if( COS_VALUE > 0 ) printf( "The triangle is acute." );
  16. else printf( "The triangle is not acute." );
  17. }
  18. else printf( "The triangle doesn't exist." );
  19. return 0;
  20. }
Success #stdin #stdout 0s 3344KB
stdin
1.3 3.86 5. 14
stdout
The triangle is not acute.