Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool triunghiuri(int a, int b, int c);
- int main()
- {
- int n, a[1000], i, k, j,c=0 ;
- cin >> n;
- for(i=1; i<=n ; i++)
- cin >>a[i];
- for(i=1; i<= n-2; i++)
- for(j=i+1; j<=n-1; j++)
- for(k=j+1; k <=n;k++)
- if(triunghiuri(a[i], a[j], a[k])==1)
- c++;
- cout << c;
- return 0;
- }
- bool triunghiuri( int a , int b, int c)
- {
- if(a+b>c && a+c>b && b+c > a)
- return true;
- else
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement