Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Pairwise AND sum

$
0
0

They have given the constraints, in the subtasks and had not told about the task. So, please tell me where we have to use these constraints, for what?

I have made a simple code for this question that is http://www.codechef.com/problems/AND

and my solution is like this

include <stdio.h>

int main() { long long int n; scanf("%d", &n); long long int A[n], i; for(i=0; i<n; i++) scanf("%d", &A[i]); long long int sum=0, j; for(i=0; i<n; i++) { for(j=i+1; j<n; j++) { sum+=A[i]&A[j]; } } printf("\n %d", sum); return 0; }


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>