Real analysis problem. Given a continuous function $f:[0,2] \to (0,+\infty)$ such that $\int_0^1 f(t)\,dt = \int_1^2 f(t)\,dt = 1$. How can I find a function $g:[0,1] \to [0,2]$ with continuous derivative such that $\int_x^{g(x)} f(t)\, dt = 1$?
I'm seeking a hint to this question.
Help?

Hint: for any $z\in[0,2]$, let $F(z)=\int_{0}^{z}f(t)\,dt$. $F(z)$ is a $C^1$ function and it is strictly increasing from $0$ to $1$ on $[0,1]$ and from $1$ to $2$ on $[1,2]$.
Assume that $x\in[0,1]$. The constraint $\int_{x}^{g(x)}f(t)=1$ is equivalent 
to
$$ F(x) = 1-\int_{g(x)}^{2}f(t)\,dt = F(g(x))-1 $$
hence formally $g(x)$ has to be picked as 
$$ g(x) = F^{-1}(F(x)+1) $$
and you just have to prove that the RHS is a $C^1$ function with the correct range.
You should have something about the degree of regularity of inverse functions in your arsenal.
