Heating up water with a heat pump 
Suppose we wish to heat 1 litre of 0°C water up to 50°C during wintertime by using an ideal heat pump (Carnot cycle in "reverse"). We will place this water amount in an initally empty container, in which the heating will take place, and via the heat pump extract heat from a nearby large lake  where the water is near 0°C. How much work will this require? 
Note that the initially empty container and the large lake represents the hot reservoir and cold reservoir respectively in the Carnot cycle.

For a Carnot cycle we have $W = Q_h - Q_c$ and $\displaystyle \frac {Q_h}{T_h} = \frac {Q_c}{T_c}  $ where the subscripts $h$ and $c$ denote the hot reservoir and cold reservoir respectively. Moreover $W, Q_h, Q_c, T_h, T_c$ are all non-negative quantities (our chosen sign convention).

I know the work can be expressed as $W = \frac{Q_h}{T_h} (T_h - T_c)= \frac{Q_c}{T_c} (T_h - T_c) $ but I have no clue which to use since I really have no idea what the heat amounts $Q_h$ and $Q_c$ are or ought to be.
Also I've never previously encountered a problem of this kind where one of the reservoirs is not at a constant temperature and I'm completely confounded. I suspect it will require calculus but I am dumbfounded as to how to set it up.
Since we want to heat up the water from 0°C and 50, shouldn't $Q_h$ equal $mc \Delta T$ which amounts to $210 \, 000 \text{ J}$ with $m = 1 \text{ kg}$, $c = 4200 \text{ J/(kg}\cdot\text{K)}$ and $\Delta T=50 \text{ K}$? The question is what to plug in for $T_h$ since it varies over time.
The answer is supposed to be $W = 17.1 \text{ kJ}$. Any help appreciated!
 A: The ideal heat pump consists of four stages: an adiabatic expansion $(1)$ from $V_1$ at $T_H$ to $V_2$ at $T_C$, an isothermal expansion $(2)$ at $T_C$ from $V_2$ to $V_4$, an adiabatic compression $(3)$ from $V_4$ at $T_C$ to $V_3$ at $T_H$, and an isothermal compression $(4)$ at $T_H$ from $V_3$ to $V_1$, where $V_1 < V_2 < V_3 < V_4$.
Since the heat pump is only in contact with the hot reservoir during stage $(4)$, that's the only stage where the heat pump actually transfers heat to the water. But if we want to transfer heat to the water, then the temperature of the water must increase during that process, and it isn't an isothermal process anymore! This question does not involve an ideal heat pump, and you can't apply any of those equations.
What you can try is replacing $(4)$ with a process, like an isothermal one, where you put the heat pump in contact with the hot reservoir and then compress it from $V_3$ to $V_1$ such that the heat pump and the hot reservoir is always at thermal equilibrium. This process is not isothermal, since the temperature of the hot reservoir will change from $T_H$ to a higher temperature $T_X$ at the end, so it's hard to find the work done on the gas, since all of $T$, $V$, $P$, and $U$ are changing. Feel free to edit this answer if anyone can find an equation for the work done on the gas during process $(5)$ from $V_3$ at $T_H$ to $V_1$ at $T_X$, given that the temperature of the gas and the temperature of the hot reservoir always stays the same and that all the heat out of the gas goes into the hot reservoir.
Where did you get this problem? Can you ask whoever gave it to you to provide a solution?
