MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / solve

Function solve

CodeChef_problems/CENS20D/solution.cpp:25–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25void solve(){
26 int N;
27 cin>>N;
28 int A[N]; //init an array
29 int count = 0; //creating counter variable
30 for(int i = 0;i<N;i++){
31 cin>>A[i]; //input all the integers
32 }
33 for(int i = 0;i<N;i++){
34 for(int j=i+1 ; j<N ; j++){
35 if((A[i]&A[j])==A[i]) //check if their bitwise AND matches the first operand
36 count++; //if yes the count this pair
37 }
38 }
39 cout<<count<<endl; //print the number of pairs
40}

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected