翻译8

https://acs.jxnu.edu.cn/problem/HDU1024
Max Sum Plus Plus
描述:
Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem.
Given a consecutive number sequence S1, S2, S3, S4 ... Sx, ... Sn (1 ≤ x ≤ n ≤ 1,000,000, -32768 ≤ Sx ≤ 32767). We define a function sum(i, j) = Si + ... + Sj (1 ≤ i ≤ j ≤ n).
Now given an integer m (m > 0), your task is to find m pairs of i and j which make sum(i1, j1) + sum(i2, j2) + sum(i3, j3) + ... + sum(im, jm) maximal (ix ≤ iy ≤ jx or ix ≤ jy ≤ jx is not allowed).
But I`m lazy, I don't want to write a special-judge module, so you don't have to output m pairs of i and j, just output the maximal summation of sum(ix, jx)(1 ≤ x ≤ m) instead. _
输入:
Each test case will begin with two integers m and n, followed by n integers S1, S2, S3 ... Sn.
Process to the end of file.
输出:
Output the maximal summation described above in one line.
翻译:
最大和加加
描述
现在我想你在伊格内修斯有一个交流。L的“最大和”问题。做一个勇敢的ACMer,我们总是向自己挑战更难的问题。现在你面对一个更难的问题。
给定一个连续的数字序列S1, S2, S3, S4 ... Sx, ... Sn (1 ≤ x ≤ n ≤ 1,000,000, -32768 ≤ Sx ≤ 32767)。
选择给定一个整数m (m > 0),你的任务是找到m对i和j,使sum(i1, j1) + sum(i2, j2) + sum(i3, j3) + ... + sum(im, jm)最大(ix ≤ iy ≤ jx 或 ix ≤ jy ≤ jx是不容许的)。
但是我是懒惰的,我不想写一个特别的判断模块,所以你不需要输出一对i和j,就输出sum(ix, jx)(1 ≤ x ≤ m)的最大和。
输入:
每个测试用例将从两个整数m和n开始,后面是n个整数 S1, S2, S3 ... Sn。
进行到文件结束。
输出:
在一行中输出上面描述的最大和。

posted @ 2022-02-15 18:35  zgsycbq  阅读(135)  评论(0)    收藏  举报