2 ms·
This logic is broken. If you take 1 as the initial value, and run the operation n ≥ 1 times, the initial value is used at least once. But if you run the opera
by nine_k 7y ago
This logic is broken.
If you take 1 as the initial value, and run the operation n ≥ 1 times, the initial value is used at least once.
But if you run the operation zero times, the initial value is never used, so the result is undefined.
- deleted 7y ago[deleted]
- Koshkin 7y agohttps://en.cppreference.com/w/cpp/algorithm/accumulate https://en.cppreference.com/w/cpp/algorithm/accumulate