Computer Science, asked by challayeshwanth235, 4 months ago

Bitwise AND
You are given n positions and each position has a value associated with it. You can delete only two positions but their
Bitwise AND should be greater than k Determine the numbers of pairs of positions whose Bitwise AND value is greater than
k
Input format
• First line: n (number of positions)
Second line: n space-separated integers (value associated with each position)
• Third line: k
Output format
Print the numbers of pairs of positions whose Bitwise AND value is greater thank​

Answers

Answered by aditya95250
4

Answer:

number of positions

Output format

Answered by lovekumar2017
0

Answer:

Explanation:

#include <iostream>

using namespace std;

int main()

{int n,i,j,k,count=0;

   cin>>n;

   int a[i];

   for(i=0;i<n;i++)

   {

   cin>>a[i];

   }

   cin>>k;

   for(i=0;i<n;i++)

   {for(j=i+1;j<n;j++)

       {

          if((a[i]&a[j])>k)

          count++;

       }

   }

   std::cout << "output = "<<count << std::endl;

   return 0;

}

Attachments:
Similar questions