题目链接:51nod 1065 最小正子段和 房教说用前缀和做,然后看了别人博客懂了后就感觉,这个真有意思... #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; const int inf = 0x3f3f3f3f; pair<long long, int> sum[N]; int a[N]; int n; int main(){ int i, j;
题目链接:51nod 1050 循环数组最大子段和 #include<stdio.h> #include<algorithm> using namespace std; ; long long a[N]; int main(){ int n, i; ; scanf("%d", &n); ; i <= n; ++i){ scanf("%I64d", &a[i]); sum += a[i]; } ma_ed = a[]; a
http://www.51nod.com/onlineJudge/questionCode.html#problemId=1050¬iceId=13385 参考:http://blog.csdn.net/acdreamers/article/details/38760805 #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; int n; ll a[]; ll