Question: Let $f:[0,1]\to\mathbb{R}$ be a continuous function such that $$\int_0^1f(x)dx=\int_0^1xf(x)dx.$$ Show that there is a $c\in(0,1)$ such that $$f(c)=\int_0^cf(x)dx.$$
My solution: Define the function $g:[0,1]\to\mathbb{R}$, such that $$g(x)=x\int_0^x f(t)dt-\int_0^x tf(t)dt, \forall x\in[0,1].$$
Now since $f$ is continuous on $[0,1]$, thus we can conclude by Fundamental Theorem of Calculus that $g$ is differentiable $\forall x\in[0,1]$ and $$g'(x)=\int_0^x f(t)dt+xf(x)-xf(x)=\int_0^xf(t)dt, \forall x\in[0,1].$$
Observe that $g(0)=g(1)=0$. Hence by Rolle's Theorem we can conclude that $\exists b\in(0,1)$, such that $g'(b)=0$, i.e $$\int_0^b f(t)dt=0.$$
Now define $h:[0,1]\to\mathbb{R}$, such that $$h(x)=e^{-x}g'(x), \forall x\in[0,1].$$
Now $h'(x)=-e^{-x}g'(x)+g''(x)e^{-x}=e^{-x}(g''(x)-g'(x)), \forall x\in[0,1].$
Observe that $h(0)=h(b)=0$. Hence by Rolle's Theorem we can conclude that $\exists c\in(0,b)\subseteq (0,1)$, such that $h'(c)=0$. This implies that $$e^{-c}(g''(c)-g'(c))=0\\\implies g''(c)-g'(c)=0\hspace{0.3 cm}(\because e^{-c}\neq 0)\\\implies f(c)=\int_0^cf(x)dx.$$
Is this solution correct? And is there a better solution that this?
Your proof is correct. This is another one.
We may assume that $f$ is not identically zero (otherwise it is trivial). Since $f$ is continuous and $$\int_0^1(1-x)f(x)\,dx=0$$ we have that $M=\max_{x\in [0,1]}f(x)>0$ and $m=\min_{x\in [0,1]}f(x)<0$. Moreover $\exists x_M,x_m\in [0,1]$ such that $f(x_M)=M$ and $f(x_m)=m$. Let us consider the following continuous map $$F(x):= f(x) - \int_0^xf(t)\,dt.$$ If $x_M<1,$ then $$F(x_M)=M-\int_0^{x_M}f(t)\,dt\geq M- Mx_M >0.$$ If $x_M=1$ then, $$F(x_M)=M-\int_0^{1}f(t)\,dt> 0$$ because $f$ strictly less than $M$ in an interval of positive length containing $x_m$. In both cases we conclude that $F(x_M)>0$. In a similar way, we show that $F(x_m)<0$.
Finally, since $F$ is continuous on $[0,1]$, it follows, by the Intermediate Value Theorem, that there exists $c$ strictly between $x_M$ and $x_m$, and therefore $c\in (0,1)$, such that $F(c)=0$, that is $$f(c)=\int_0^cf(t)\,dt.$$