本文共 441 字,大约阅读时间需要 1 分钟。
#include#include #include #include #include using namespace std;int dp[1000010];int main(){ int ncase; int num, temp; int max1, min1; scanf("%d", &ncase); while(ncase--) { memset(dp, 0, sizeof(dp)); scanf("%d", &num); dp[0] = 0; for(int i = 1; i <= num; ++i) { scanf("%d", &temp); dp[i] = dp[i - 1] + temp; } sort(dp, dp + num + 1); max1 = dp[num] - dp[0]; cout< <
转载地址:http://hbsgi.baihongyu.com/