Find all polynomials $f\in Z[X],$ such that for each odd prime $p$  $$f(p)|(p-3)!+\frac{p+1}{2}.$$
1. **Consider the case when \( P(x) \) is a constant polynomial:**
   - Let \( P(x) = c \) where \( c \) is a constant integer.
   - The given condition becomes \( c \mid (p-3)! + \frac{p+1}{2} \) for all odd primes \( p \).
   - For \( p = 3 \), we have \( (3-3)! + \frac{3+1}{2} = 1 + 2 = 3 \). Thus, \( c \mid 3 \).
   - The possible values for \( c \) are \( \pm 1, \pm 3 \).
   - However, for \( p = 5 \), we have \( (5-3)! + \frac{5+1}{2} = 2! + 3 = 2 + 3 = 5 \). Thus, \( c \mid 5 \).
   - The only common divisor of 3 and 5 is 1. Therefore, \( c = \pm 1 \).

2. **Consider the case when \( P(x) \) is not a constant polynomial:**
   - Assume \( P(0) \neq 0 \).
   - Let \( p \) be a prime that does not divide \( P(0) \) and \( p \nmid P(n) \) for some integer \( n \). Such a prime exists by Schur's theorem.
   - By Dirichlet's theorem, there are infinitely many primes of the form \( q = kp + n \).
   - For a sufficiently large prime \( q \), we have \( P(q) \mid (q-3)! + \frac{q+1}{2} \).
   - This implies \( p \mid q + 1 \), hence \( p \mid n + 1 \).
   - Therefore, \( p \mid P(-1) \) for infinitely many primes \( p \), which implies \( P(-1) = 0 \).

3. **Rewriting \( P(x) \) as \( P(x) = xQ(x) \):**
   - Since \( P(-1) = 0 \), we can write \( P(x) = xQ(x) \) where \( Q(x) \) is a polynomial.
   - Applying the same argument to \( Q(x) \), we get \( Q(0) = 0 \).
   - Repeating this process, we find that \( P(x) = cx^n \) for some integer \( c \) and \( n \).

4. **Determining the values of \( c \) and \( n \):**
   - Plugging \( p = 3 \) into the condition, we get \( c \cdot 3^n \mid (3-3)! + \frac{3+1}{2} = 3 \).
   - This implies \( c \cdot 3^n \mid 3 \), so \( c = \pm 1 \) and \( n = 1 \).

5. **Verification:**
   - For \( P(x) = \pm x \), we need to check if \( \pm p \mid (p-3)! + \frac{p+1}{2} \) for all odd primes \( p \).
   - Using Wilson's theorem, \((p-1)! \equiv -1 \pmod{p}\), we get \((p-3)! \equiv \frac{-1}{2} \pmod{p}\).
   - Thus, \((p-3)! + \frac{p+1}{2} \equiv \frac{-1}{2} + \frac{p+1}{2} = \frac{p}{2} \pmod{p}\).
   - Since \( p \) is odd, \(\frac{p}{2}\) is an integer, and \(\pm p \mid p\) holds true.

The final answer is \( \boxed{ P(x) = \pm x } \) or \( P(x) = 1 \).