Alecs' Blog Did you ever go clear..

Another four ACMs submitted

Easy ones.

I) Nonstop Travel

Be careful when the arriving time (in seconds) at a location is NOT integer.

II) What day is it?

Very interesting and infomative. You know what day Jan 1st 1 is? How many days are there in the month of September 1752? (Hint: run 'cal' on your UN*X box).

Two useful links:

1) Zeller's Rule 2) How about the a date

Note that both of the 2 formulas above only apply to the Gregorian Rule. (A little bit change needed for the Julian Rule).

III) Is it a tree?

Just remember each node except the root has exactly one parent, no more no less (as in real world, every one has only one father, duh!).

And dont forget those void trees (having 0 node).

PS, i've used hash table for looking up. You can use hsearch() when you are doing with strings. Well whenever for ingeter hashing, i'd go for this hash function.

IV) (Your)((Term)((Project)))

Familiar problem. You know those parentheses gotta need a stack.

Have gone crazy about a off-by-one bug. Trials-and-Fails(WAs). Should have been calm enough. Should have done this problem ACed in 10 minutes.

18 Sep 2004

Fork me on GitHub