Count of a , b & c after n seconds for given reproduction rate | C ++ implementation of the approach ; Function to print the count of a , b and c after n seconds ; Number of multiples of 60 below n ; Multiple of 60 nearest to n ; Change all a to b ; Change all b to c ; Change each c to two a ; Print the updated values of a , b and c ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define ull  unsigned long long NEW_LINE void findCount ( int n ) { ull a = 1 , b = 0 , c = 0 ; int x = n / 60 ; a = ( ull ) pow ( 32 , x ) ; x = 60 * x ; for ( int i = x + 1 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) { b += a ; a = 0 ; } if ( i % 5 == 0 ) { c += b ; b = 0 ; } if ( i % 12 == 0 ) { a += ( 2 * c ) ; c = 0 ; } } cout << " a ▁ = ▁ " << a << " , ▁ " ; cout << " b ▁ = ▁ " << b << " , ▁ " ; cout << " c ▁ = ▁ " << c ; } int main ( ) { int n = 72 ; findCount ( n ) ; return 0 ; }