here is only basic implementation of problems for beginners. If you have any problem with any solution or any basic concept of programming or you want more efficient solution you can mail me.
my suggestion is not to copy and paste codes from here try to understand the logic and think why you were not able to solve it.

Sunday 14 September 2014

Spoj enough of analyzing lets play

#include<stdio.h>
int main(){
int t,a,n,i,j,b,u,ar[10000],c=1;
scanf("%d",&t);
while(t--){
j=0;
scanf("%d",&n);
scanf("%d",&ar[0]);
if(n>=2){
scanf("%d",&ar[1]);
u=ar[0]^ar[1];
}
for(i=2;i<n;i++){
scanf("%d",&ar[i]);
u^=ar[i];
}
if(n==1){
printf("Case %d: 1\n",c);
}else{
for(i=0;i<n;i++){
a=u^ar[i];
if(a<ar[i]){
j++;
}
}
printf("Case %d: %d\n",c,j);
}
c++;
}
return 0;
}

No comments:

Post a Comment