Count of N | C ++ program for the above approach ; Function to find the value of X to the power Y ; Stores the value of X ^ Y ; If y is odd , multiply x with result ; Update the value of y and x ; Return the result ; Function to count number of arrays having element over the range [ 0 , 2 ^ K - 1 ] with Bitwise AND value 0 having maximum possible sum ; Print the value of N ^ K ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int power ( int x , unsigned int y ) { int res = 1 ; while ( y > 0 ) { if ( y & 1 ) res = res * x ; y = y >> 1 ; x = x * x ; } return res ; } void countArrays ( int N , int K ) { cout << int ( power ( N , K ) ) ; } int main ( ) { int N = 5 , K = 6 ; countArrays ( N , K ) ; return 0 ; }