版本比较
题解:P1001 A+B Problem
正文
增加 4 行删除 4 行
23 行未改动242526272828293030313233347 行未改动4243444546464748495017 行未改动6869707172727374757625 行未改动23 行未改动`std::partial_sum` 也可以重载加法运算,使用方法如下,在此不再赘述。
```cpptemplate <class InputIterator, class OutputIterator, class BinaryOperation>OutputIterator partial_sum (InputIterator first, OutputIterator partial_sum (InputIterator first, InputIterator last, OutputIterator result, OutputIterator result, BinaryOperation binary_op);```
# 代码7 行未改动namespace IO { inline int read() { int x = 0, f = 1; char ch = getchar(); while(ch > '9' || ch < '0') { if(ch == '-') f = -1; if(ch == '-') f = -1; ch = getchar(); } while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch - 48), ch = getchar(); return x * f;17 行未改动 a.push_back(tmp); } cnt.resize(a.size()); std::partial_sum(a.begin(), a.end(), cnt.begin()); IO::write(*cnt.rbegin()); IO::write(*cnt.rbegin()); return 0;}```
25 行未改动