A friend posted this on their Facebook page, it's quite an interesting problem. Try reading the problem before the answer: I had actually confused myself quite a bit trying to figure out some "algorithm" to solve this problem, when really it is truly, logical.
Source: http://xkcd.com/blue_eyes.html
Source: http://xkcd.com/blue_eyes.html