Welcome to RTA!
With only 5 days, you can do this trip, but you won't have enough time to do anything in Tetons/Yellowstone but scratch the surface. It's a full day's drive (10+ hours) from Denver to Jackson. Yellowstone to Glacier is about 7 hours. Glacier to Seattle is another 10 hour day. This gives you only 1 day in Tetons/Yellowstone, which really isn't anywhere near enough. 1 day in Glacier is adequate.
Hotels in Jackson and around Yellowstone (West Yellowstone, Gardiner) are expensive. Around Glacier, prices aren't too bad in Kalispell.