Charging Capacitor Voltage

Hi all. I have a question about charging capacitor voltage when it comes to the Energy stored/delivered equation E= ½CV², as I feel like I may be overthinking this or missing something.

When the capacitor is charging, there is current flowing through the resister, so shouldn’t we have to divide the voltage between the capacitor and resistor? This would result in a lower amount of energy stored in the capacitor. The solution says a charged capacitor acts as an open circuit, which would then raise the voltage across the capacitor to DC Link input voltage and start charging again. but then wouldn’t the voltage immediately drop again due to the resister having voltage? Wouldn’t this cause the capacitor to oscillate charge/open circuit? Or does the capacitor draw less and less charging current which in turn reduces resister voltage until nil?

This came up in quiz 7.4: