示例代码:
#include <bits/stdc++.h>
using namespace std;
int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int main() {
partial_sum(a, a+11, a);
// a已经变为了原来的a的前缀和了
for (int i = 0; i <= 10; i ++)
cout << a[i] << endl;
return 0;
}
示例代码:
#include <bits/stdc++.h>
using namespace std;
int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int main() {
partial_sum(a, a+11, a);
// a已经变为了原来的a的前缀和了
for (int i = 0; i <= 10; i ++)
cout << a[i] << endl;
return 0;
}