1) "With" is not necessary. " 2) The connection of the "slice of bread" (which he had for dinner) and the "cheeses" (part of the math problem) is humorous. It is a figure of speech.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.