Advertisement
tuki2501

triangle.cpp

Feb 23rd, 2022
847
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. signed main() {
  5.   cin.tie(0)->sync_with_stdio(0);
  6.   vector<int> a(5);
  7.   for (int i = 0; i < 5; i++) {
  8.     cin >> a[i];
  9.   }
  10.   int ans = 0;
  11.   for (int i = 0; i + 2 < 5; i++)
  12.   for (int j = i + 1; j + 1 < 5; j++)
  13.   for (int k = j + 1; k < 5; k++) {
  14.     if (a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i]) {
  15.       ans++;
  16.     }
  17.   }
  18.   cout << ans << '\n';
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement