Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <numeric>
  4.  
  5.  
  6. using namespace std;
  7. int main(){
  8. vector<int> a(10,1);
  9. adjacent_difference(a.begin(), std::prev(a.end()), std::next(a.begin()), std::plus<> {});
  10. copy(a.begin(), a.end(), std::ostream_iterator<int> {std::cout, " "});
  11. cout << endl;
  12. vector<int> b{0,2,5,4,2};
  13. adjacent_difference(b.begin(), std::prev(b.end()), next(b.begin()) , std::plus<> {});
  14. copy(b.begin(), b.end(), std::ostream_iterator<int> {std::cout, " "});
  15. return 0;
  16. }
  17.  
  18. 1 1 2 3 5 8 13 21 34 55
  19. 0 0 0 0 0
  20. Process finished with exit code 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement