Advertisement
Guest User

11

a guest
Oct 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int x;
  8. cin >> x;
  9. int y [x];
  10. int t [x-1];
  11. for(int u=0; u<=x-1; u++)
  12. {
  13. cin >> y [u];
  14. }
  15.  
  16. for(int i=0; i<=x-2; i++)
  17. {
  18. t[i]=y [i+1]-y [i];
  19. }
  20.  
  21. for(int o=0; o<=x-2; o++)
  22. {
  23. if(t [o]==t [o+1])
  24. {
  25. cout << y [o] << endl << y [o+1] << endl << y [o+2];
  26. return 0;
  27. }
  28. }
  29.  
  30. cout << "-1";
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement