Advertisement
aryobarzan

Codeforces 6-A

Mar 18th, 2011
4,213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool tr(int a,int b,int c)
  5. {
  6.   return ((a+b>c)&&(a+c>b)&&(b+c>a));
  7. }
  8.  
  9. bool seg(int a,int b,int c)
  10. {
  11.   return ((a==b+c)||(b==a+c)||(c==a+b));
  12. }
  13.  
  14. int main()
  15. {
  16.   bool normal=false;
  17.   bool deg=false;
  18.   int a,b,c,d;
  19.   cin>>a>>b>>c>>d;
  20.   normal=normal||(tr(a,b,c));
  21.   normal=normal||(tr(a,b,d));
  22.   normal=normal||(tr(a,c,d));
  23.   normal=normal||(tr(b,c,d));
  24.  
  25.  
  26.   deg=deg||(seg(a,b,c));
  27.   deg=deg||(seg(a,b,d));
  28.   deg=deg||(seg(a,c,d));
  29.   deg=deg||(seg(b,c,d));
  30.  
  31.   if(normal)
  32.     cout<<"TRIANGLE"<<endl;
  33.   else if(deg)
  34.     cout<<"SEGMENT"<<endl;
  35.   else
  36.     cout<<"IMPOSSIBLE"<<endl;
  37.  
  38.   return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement