Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <cstdlib>
- #include <algorithm>
- #include <cmath>
- #include <iomanip>
- using namespace std;
- #define ll long long
- void sherry()
- {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- ll n;
- ll i = 0;
- ll recursion(ll arr[], ll i)
- {
- if (n == i)
- return 1;
- return arr[i] == arr[n - i - 1] && recursion(arr, i + 1);
- }
- int main()
- {
- sherry();
- cin >> n;
- ll arr[n];
- for (int i = 0; i < n; i++)
- cin >> arr[i];
- recursion( arr, i) ? cout << "YES" : cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement