Frank makes it clear that if anyone breaks the rules then all the virgins will die, then allows the unfortunate ladies to consult before lining them up.

I think you have it, but just haven't quite articulated the thought process each virgin uses.

The first virgin counts all the blue hats in front of her (call it

q) and then answers, "Red," if the number is odd or "Blue," if the number is even. Each subsequent virgin keeps track of the number of blue hats known to have been saved from behind her (call it

y), then counts the number of blue hats in front of her (call it

z).

If

q was even, and if

y&

z are either both even or are both odd, then the virgin would answer, "Red." Otherwise, the virgin would answer, "Blue."

If

q was odd, and if

y&

z are either both even or are both odd, then the virgin would answer, "Blue." Otherwise, the virgin would answer, "Red."

You are correct that this approach

guarantees the survival of 99 virgins, with a 50/50 chance of the survival of the 100th.

Well done, sir! I look forward to your next submission.