Count of Binary Strings possible as per given conditions | C ++ Program to implement the above approach ; Function to generate maximum possible strings that can be generated ; Maximum possible strings ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; long long countStrings ( long long A , long long B , long long K ) { long long X = ( A + B ) / ( K + 1 ) ; return ( min ( A , min ( B , X ) ) * ( K + 1 ) ) ; } int main ( ) { long long N = 101 , M = 231 , K = 15 ; cout << countStrings ( N , M , K ) ; return 0 ; }