Saturday, March 2, 2013

BINARY STAIRLING NUMBER


//http://www.spoj.com/problems/BINSTIRL/
#include<stdio.h>
int main()
{
int t,n,k;
scanf("%d",&t);
while(t--)
{
scanf("%d %d",&n,&k);
if((n-k)&(k-1)/2)
printf("0\n");
else
printf("1\n");
}
return 0;
}

1 comment:

  1. please explain me the solution.i'm not getting how did u done with this logic.

    ReplyDelete