Do you mean 20 days in Europe or 20 days away from home? Count nights in Europe. If you have 19 nights, you really have only 18 full days. Even if you land early in the morning, it usually takes 2-3 hours to get through the airport and to your hotel, then have lunch. After a long flight, you may be in a jetlagged haze for the rest of the day and not really soak in much. Unless you have an evening flight home, you won't be able to see or do much on your last day either.
I'm guessing that you're flying round-trip Munich because there are non-stop flights. I'd take the train to Salzburg and spend 3 nights (3N). You'll want to be in Munich at the end of the trip to be near the airport, so going right to Salzburg saves one hotel change. Then train to Vienna (3-4N), then train to Budapest (3-4N), then fly to Prague (train takes too long) (3-4N), then train or fly to Munich (3-4N). Remember, 3 nights gives you 2 full days. You'll use about 1/2 day in travel (door-to-door) each time you move.
Whether you spend 3 or 4 nights in a city really depends on what you want to see and do there. You can see Salzburg's highlights in a day. But since you'll still be recovering from the time change, you should stay the extra day. You will certainly find enough to enjoy to fill 2 days. I didn't find Munich particularly to my liking, but I could have spent more than 3 full days in Prague, and I have spent more than that in Vienna and Budapest.
BTW you haven't told us when you are planning to visit. That could change our recommendations.