How to prove $f(n)$ is one by one function? If we want to show $A$ has same cardinality of $ B$ we use a function one to one and onto ,to prove $card(A)=card(B)$.
To prove $\mathbb{N}\sim\mathbb{Z}$ we can use $$f(n):\mathbb{N}\mapsto \mathbb{Z}\\f(n)=(-1)^n\lfloor\frac n2\rfloor$$ 
so$$1 \mapsto 0\\2\mapsto+1\\3\mapsto -1\\4 \mapsto+2\\5\mapsto -2\\6\mapsto+3\\7\mapsto-3\\\vdots$$ this obvious that $f(n)$ is a Bijection ,but I get stuck how to prove it by definition . 
Sorry if my question is intuitive . 
Thanks in advance  for any hint,guide or solution (or any Idea more)
 A: (Intended as a clarifying hint; I will leave further work to you, although I can supply additional details if you indicate where, precisely, you are stagnating.)
To prove that this is a bijection, you need to show two things:
1. That $f: \mathbb{N} \rightarrow \mathbb{Z}$ is onto. In other words, for each $n \in \mathbb{Z}$, you must show that there exists $k \in \mathbb{N}$ for which $f(k) = n$.
2. That $f: \mathbb{N} \rightarrow \mathbb{Z}$ is one-to-one. In other words, for all $a, b \in \mathbb{N}$, it must be the case that $f(a) = f(b)$ implies $a = b$.
To prove 1 and 2 above, it may help to break into various cases, such as even versus odd (as suggested in a comment) and/or positive versus negative. 
A: Essentially your function is
$$f(n)=\begin{cases}
\quad\dfrac n2\qquad \text{if $n$ is even}\\
-\dfrac {n+1}{2}\quad \text{if $n$ is odd}
\end{cases}$$
Injectivity:
Assume $f(a)=f(b)$. Then we have two cases:
If $f(a),f(b)$ are positive, $\frac{a}{2}=\frac{b}{2} \implies a=b$.
If $f(a),f(b)$ are negative, $-\frac {a+1}{2}=-\frac {b+1}{2}\implies a=b$.
Surjectivity:
I'll let you finish this one off. Take some $x\in\mathbb{Z}$. If $x$ is positive, then ... and if $x$ is negative, then ... .
