This is exercise 18.4.B in Vakil's FOAG.
Suppose $D$ is a divisor on a regular projective curve $C$ over a field $k$. Show that $\lambda(C,\mathcal{O}_C(D)) = \mathrm{deg} D + \lambda(C,\mathcal{O}_C)$
As said in the hint, an essential step is to tensor the closed subscheme exact sequence $$ 0 \to \mathcal{O}_C(-p) \to \mathcal{O}_C\to \mathcal{O}|_p \to 0 $$ by $\mathcal{O}_C(D)$. For the new short sequence to be exact, we need $\mathcal{O}_C(D)$ to be a line bundle, so that $- \otimes \mathcal{O}_C(D)$ is exact.
But I can't see $\mathcal{O}_C(D)$ is a line bundle, any hint is welcome.
Edit: We define $\mathcal{O}_X(D)$ by
$\Gamma(U, \mathcal{O}_X(D)):= \{t\in K(X)^{\times} :div|_U t +D|_U \ge0 \} \cup \{ 0\}$
and define $\mathrm{deg} D = \Sigma a_p \mathrm{deg} p$, where $\mathrm{deg}p$ is the degree of the field extension of the residue field over $k$.