If $x$ is an integer, find the maximum value of $$f(x)=x-\left(\lfloor r_1x\rfloor+\lfloor r_2x\rfloor+\lfloor r_3x\rfloor+...+\lfloor r_{n-2}x\rfloor+\lfloor r_{n-1}x\rfloor+\lfloor r_nx\rfloor\right)$$ Given that $\sum r_i = 1$, where $r_i \in \mathbb{Q} \space\forall i$.
So, first I applied the identity of $\lfloor r_ix\rfloor = r_ix - \{r_ix\}$ $$f(x)=x-\left(x\left(\sum r_i\right) - \left(\sum \{r_ix\}\right)\right)$$ And since $r_i$ sums to $1$, all we need to do is find the maximum value of $$f(x) =\sum \{r_ix\}$$ But $\{r_ix\} \in [0,1)$, and since we are summing from $i=1$ to $n$, and thus, there are $n$ terms in the sum, I'm tempted to say the maximum is $n-1$. A maximum value of $n$ would imply the upper bound on the fractional function is closed. Is that accurate?