This is a variant of the classical two roads, two guards problem, except that
two different guards (one telling the truth, one lying) is replaced by two different statements by the same guard (one truth, one lie).
So the question should be:
If my next question will be "does this road lead to the post office", what will you say?
The sentry has a habit of alternately speaking the truth and telling a lie, so:
- If his answer now is the truth, then
his next statement will be a lie, so he will give you the false answer that he would give for the next question.
- If his answer now is a lie, then
his next statement will be truthful, so he will lie and give you the false answer now.
Either way, you've got your answer
about whether that road leads to the post office - which, since it's false, you take as the answer about whether it leads to the university.