文章
1
粉丝
63
获赞
0
访问
594
#include <bits/stdc++.h>
using namespace std;
int maxSum(int a[], int n, int &bgn, int &ed);
int main(int argc, const char **argv)
{
int n;
int maxLen = 0;
int begin = 0;
int end = 0;
while (cin >> n)
{
if (!n)
break;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
maxLen = maxSum(a, n, begin, end);
cout << maxLen << " " << a[begin] << " " << a[end] << endl;
}
return 0;
}
int maxSum(int a[], int n, int &bgn, int &ed)
{
int sum = 0; // 最大连续子序列长度
...
登录后发布评论
暂无评论,来抢沙发