Find all continuous functions $f : \mathbb R \to \mathbb R$ such that for all $x \in \mathbb R$ and for all $n \in \mathbb N^{\ast}$ we have \[ n^2 \int_{x}^{x + \frac{1}{n}} f(t) \, dt = n f(x) + \frac12 .  \]

[i]Mihai Piticari[/i]
1. Given the functional equation:
   \[
   n^2 \int_{x}^{x + \frac{1}{n}} f(t) \, dt = n f(x) + \frac{1}{2}
   \]
   for all \( x \in \mathbb{R} \) and \( n \in \mathbb{N}^{\ast} \).

2. Since \( f \) is continuous, we can use the Mean Value Theorem for integrals. There exists some \( c \in \left( x, x + \frac{1}{n} \right) \) such that:
   \[
   \int_{x}^{x + \frac{1}{n}} f(t) \, dt = f(c) \cdot \frac{1}{n}
   \]
   Substituting this into the given equation, we get:
   \[
   n^2 \left( f(c) \cdot \frac{1}{n} \right) = n f(x) + \frac{1}{2}
   \]
   Simplifying, we obtain:
   \[
   n f(c) = n f(x) + \frac{1}{2}
   \]
   Dividing both sides by \( n \):
   \[
   f(c) = f(x) + \frac{1}{2n}
   \]

3. As \( n \to \infty \), \( c \to x \) because \( c \in \left( x, x + \frac{1}{n} \right) \). Since \( f \) is continuous, we can take the limit on both sides:
   \[
   \lim_{n \to \infty} f(c) = \lim_{n \to \infty} \left( f(x) + \frac{1}{2n} \right)
   \]
   \[
   f(x) = f(x) + 0
   \]
   This confirms that the equation holds as \( n \to \infty \).

4. To find the form of \( f(x) \), we assume \( f \) is differentiable. Let \( f(x) = kx + c \) where \( k \) and \( c \) are constants. We substitute \( f(x) = kx + c \) into the original equation:
   \[
   n^2 \int_{x}^{x + \frac{1}{n}} (kt + c) \, dt = n (kx + c) + \frac{1}{2}
   \]
   Evaluating the integral:
   \[
   \int_{x}^{x + \frac{1}{n}} (kt + c) \, dt = \int_{x}^{x + \frac{1}{n}} kt \, dt + \int_{x}^{x + \frac{1}{n}} c \, dt
   \]
   \[
   = k \left[ \frac{t^2}{2} \right]_{x}^{x + \frac{1}{n}} + c \left[ t \right]_{x}^{x + \frac{1}{n}}
   \]
   \[
   = k \left( \frac{(x + \frac{1}{n})^2}{2} - \frac{x^2}{2} \right) + c \left( x + \frac{1}{n} - x \right)
   \]
   \[
   = k \left( \frac{x^2 + \frac{2x}{n} + \frac{1}{n^2}}{2} - \frac{x^2}{2} \right) + c \cdot \frac{1}{n}
   \]
   \[
   = k \left( \frac{2x}{2n} + \frac{1}{2n^2} \right) + c \cdot \frac{1}{n}
   \]
   \[
   = k \left( \frac{x}{n} + \frac{1}{2n^2} \right) + c \cdot \frac{1}{n}
   \]
   \[
   = \frac{kx}{n} + \frac{k}{2n^2} + \frac{c}{n}
   \]

5. Multiplying by \( n^2 \):
   \[
   n^2 \left( \frac{kx}{n} + \frac{k}{2n^2} + \frac{c}{n} \right) = n (kx + c) + \frac{1}{2}
   \]
   \[
   n kx + \frac{k}{2} + nc = n kx + nc + \frac{1}{2}
   \]

6. Comparing both sides, we see that:
   \[
   \frac{k}{2} = \frac{1}{2}
   \]
   \[
   k = 1
   \]

7. Therefore, \( f(x) = x + c \).

8. Substituting \( f(x) = x + c \) back into the original equation confirms that it satisfies the given condition.

The final answer is \( \boxed{ f(x) = x + c } \).