
链接:hdu5586
- There is a number sequence {A}_{1},{A}_{2}….{A}_{n},you can select a interval [l,r] or not,all the numbers
- {A}_{i}(l leq i leq r) will become f({A}_{i}).f(x)=(1890x+143) mod 10007.After that,the sum of n numbers
- should be as much as possible.What is the maximum sum?
Input
- There are multiple test cases.
- First line of each case contains a single integer n.(1leq nleq {10}^{5})
- Next line contains n integers {A}_{1},{A}_{2}….{A}_{n}.(0leq {A}_{i}leq {10}^{4})
- It’s guaranteed that sum nleq {10}^{6}.
Output
Sample Output
19999
22033
题解
- 最大子段和
1 |
|




近期评论