Advertisement
Guest User

Codice Fluttuazioni finanziarie

a guest
Oct 28th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4. #include <cmath>
  5. using namespace std;
  6. int main ()
  7. {
  8. ifstream in ("input.txt");
  9. ofstream out ("output.txt");
  10. int N,Q,temp,temp1,max1=0,max=0;
  11. in>>N;
  12. vector <int> numeri;
  13. for (int i=0;i<N;i++)
  14. {
  15. in>>Q;
  16. numeri.push_back(Q);
  17. }
  18. for (int i=0;i<N;i++)
  19. {
  20. temp=abs(numeri[i]-numeri[i+1]);
  21. if (temp>max)
  22. max=temp;
  23. }
  24. out<<max;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement