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