// 2022 IUSB Programming Competition // Round 1 Problem 5 // Triamgles // Solution by Liguo Yu #include using namespace std; int formTriangles(int * a, int size); int main() { int m; cin >> m; int * a = new int[m]; for (int i = 0; i < m; i++) { cin >> a[i]; } cout << formTriangles(a, m); return 1; } int formTriangles(int * a, int size) { int result = 0; for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { for (int k = j + 1; k < size; k++) { if (a[i] + a[j] > a[k] && a[i] + a[k] > a[j] && a[j] + a[k] > a[i]) { result = result + 1; } } } } return result; }