Saturday 18 July 2015

BINSTIRL

Binary Stirling Numbers

Link to the question : BINSTIRL 

HINT :

Read the article on wikipedia on binary stirling numbers. There you will also find a formula  to check the pairity of them.

RECOMMENDED QUESTION :

Try this dp question .

SOURCE CODE :

#include <stdio.h>
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
    long long int n,m;
scanf("%lld%lldd", &n, &m);
printf("%d\n", !((n-m)&((m-1)>>1)));
}
return 0;
}

No comments:

Post a Comment