标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 206947 Accepted Submission(s):
48397
#include <iostream> #include <fstream> #include <cstdio> using namespace std; int main() { //fstream cin("aaa.txt"); int t, jishu = 1; cin >> t; while (t--) { int n, dp = 0, max = -1000001, r = 1, l = 1, temp = 1; cin >> n; for(int i = 1; i <= n; i++) { int tep; cin >> tep; dp += tep; if (dp > max) { max = dp; r = temp; l = i; } if (dp < 0) { dp = 0; temp = i + 1; } } printf("Case %d:\n%d %d %d\n", jishu++, max, r, l); if (t != 0) cout << endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/lyf-acm/p/5433991.html