How find this minimum of the value $f(1)+f(2)+\cdots+f(100)$ Give the positive integer set $A=\{1,2,3,\cdots,100\}$, and define function
$f:A\to A$ and 
(1):such for any $1\le i\le 99$,have
$$|f(i)-f(i+1)|\le 1$$
(2): for any $1\le i\le 100$,have $$f(f(i))=100$$
find the minium of the value
$$f(1)+f(2)+f(3)+f(4)+\cdots+f(99)+f(100)$$
maye this is nice problem,and I want use $|f(i)-f(i+1)|\le 1$,But I can't it.Thank you
Now it is said this answer is 8350
 A: Let $n$ be the largest number such that $f(n)\ne 100$.  By property (2), there does not exist an $i$ such that $f(i)=n$; by property (1), the graph of $f$ cannot "cross" $n$.  Thus $f$ has these two properties:
(i) $f(A)\subseteq[n+1,100]$
(ii) $f([n+1,100]) = \{100\}$
Furthermore, any function having properties (i) and (ii) has property (2).
Of all functions satisfying properties (1), (i), and (ii), the smallest (pointwise, and therefore also in the sense of $\sum_i f(i)$) will have a graph that looks either like
100             * * * * *
              *
            *
          *
        *
      *
    *




    1 2 3 ... n n+1 ... 100

or like
100                   * * * * * *
                    *
                  *
                *
              *
n+1 * * * * *



    1 2 3    ...    n n+1 ... 100

For functions of these types, the value of $\sum_{i=1}^{100} f(i)$ can be computed explicitly as a function of $n$; it'll turn out to be piecewise quadratic in $n$, so you can find the minimum using standard techniques from high school algebra.
A: As Test Observed, here is a start, the solution is incomplete.
First observe that by repeatedly applying  $(1)$ you get the following:
If $1 \leq i < j < 100$ then 
$$\left|f(i)-f(j)\right| \leq j-i \,.$$
Now, if $f(i)=j$ we either have $j =100$ or, by the above
$$ 100-j =|f(i)-f(j) | \leq |j-i| \,.$$
This implies that
$$100-j \leq i-j \, \mbox{or} \, 100-j \leq j-i \,.$$
Therefore , for all $1 \leq i \leq 99$ we have
$$ f(i) \geq \frac{100+i}{2}$$
As $f(i)$ is an integer, for all $1 \leq i\leq 99$ we have
$$f(i) \geq [ \frac{100+i}{2} ] \,,$$
where $[]$ denotes rounded up.
Next, let $f(1)=a$ with $51 \leq a \leq 100$.
I would cover the case $f(1)=100$ separately, lets look at the case $51 \leq a \leq 99$.
The solution can be completed in a very ugly way, by covering all the cases for $f(1)$, but there should be a simpler solution.
A: Claim: to achieve the minimum, f(n) is a non decreasing function. Suppose not, take the natural construction $f^*(n)$ where we smooth out the decreasing part, show that it satisfies the conditions and has a smaller sum. 
Claim: Suppose that The image of $f(n)$ consists of $k$ elements. Then, because we have a non decreasing function, we see that the minimum sum occurs when we have $f(1)=\ldots=f(100-2k+2)=100-k+1, f(100-2k +j)=100-k+j-1$ for j from 3 to k and $f(100-k+1)=\ldots=f(100)=100$. 
It remains to verify that the minimum sum is achieved at $k=34$  This is easily done n
A: (Edited)
My try:
$$
f(x)=\left\{ \begin{array}{ll}
67,& \mbox{if } 1\le x\le 34;\\
33+x,& \mbox{if } 34\le x \le 67;\\
100, &\mbox{if } 67\le x \le 100.\end{array} \right.
$$
Then $$f(1)+f(2)+...+f(100)=34\cdot 67 + (68+69+...+99) + 34\cdot 100 =2278 + 2672 + 3400 = \large{8350}.$$

My approach:
Denote $A_{100}$ is the set of $a\in A$, that $f(a)=100$.
If $A_{100}=A$, it isn't optimal solution ($f(x)\equiv 100$).
Then $A_{100}$ is "bounded" with the set $A_{99}$ (set of such $a\in A$, that $f(a)=99$).
Then (2) $\implies f(99)=100$.
But if $A_{99} \bigcup A_{100} = A$, then it isn't optimal solution too.
Next step: then $A_{99}$ is "bounded" with the set $A_{98}$ (set of such $a$ ...). Then (2) $\implies f(98)=100$.
And so on...
