Monthly Archives: November 2007

jarsmall.jpg

I made the vase and my sister made the rose and the leaves. The vase appears a little highlighted, doesn’t it? Well, it’s my blog and I took the trouble to take the pic. It’s clay, by the way. Should’ve named it Vases are Blue. :P

My brother is studying in tenth standard.

I: Do you know factorial?
He: (vigorously nodding his head) one into two into three into four into five into six into seven into eight into nine into ten into eleven into twelve into…
I: (irritated) I was going to ask you four factorial.
He: byeeeeeeeee five into six into…

I’m suddenly interested in blogging a little more actively. Let’s see how long this interest lasts. On a personal note, god save me if my life is gonna be a series of disjoint passions.

I knew of the implementation of considering all the subsets of a set using bitmasks – suppose that the superset contains n elements. The number of its subsets is N=2^n.
for(i=0; i<N; i++)
for(j=0; j<n; j++) if((i>j)&1) { jth bit of i is set; consider it as “jth element of n elements is chosen” and do things; }
Tautology in SPOJ is solvable using just this, if you knew how to evaluate a prefix expression.

What I wanted to mention, however, is that the function __builtin_popcount(unsigned int x) returns the number of bits set in x. It is a built-in function in GCC. Another thing I came across today and wasn’t aware of till now -
__FILE__ is a macro for the filename of the program,
__LINE__ for the current line number,
__DATE__ for the date as a string,
__TIME__ for the current time as a string.