Count of triples ( A , B , C ) where A * C is greater than B * B | C ++ implementation ; function to return the count of the valid triplets ; Driver Code ; function calling
#include <bits/stdc++.h> NEW_LINE using namespace std ; long long countTriplets ( int A , int B , int C ) { long long ans = 0 ; for ( int i = 1 ; i <= A ; i ++ ) { for ( int j = 1 ; j <= B ; j ++ ) { for ( int k = 1 ; k <= C ; k ++ ) { if ( i * k > j * j ) ans ++ ; } } } return ans ; } int main ( ) { int A , B , C ; A = 3 , B = 2 , C = 2 ; cout << countTriplets ( A , B , C ) ; }