Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int N, a1, a2, outNumber, a3;
- cin >> N;
- int k = 1;
- if (N >= 3)
- {
- cin >> a1;
- cin >> a2;
- cin >> a3;
- for (int i = 0; i < N - 3; ++i)
- {
- if (k != 0)
- {
- if ((a2 - a1 == a3 - a2) && (a2 - a1 > 0))
- {
- outNumber = a3;
- k = 0;
- }
- else
- {
- a1 = a2;
- a2 = a3;
- cin >> a3;
- }
- }
- else
- {
- cout << a1 << " " << a2 << " " << a3;
- return 0;
- }
- }
- cout << -1;
- }
- else
- {
- cout << -1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement