Advertisement
semsem_elazazy

https://codeforces.com/group/n3sTiYtHxI/contest/348734/problem/V

Feb 22nd, 2022
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #define ll long long
  4. using namespace std;
  5.  
  6.  
  7. bool palindrome(int arr1[],int n){
  8.    
  9.     int arr2[n]=reverse(arr1 , arr1+n);
  10.    
  11.     for(int i =0 ,int j=0 ; i<n ,j<n  ; i++,j++){
  12.         if (arr1[i] != arr2[j])   return false;
  13.     }
  14.     return true ;
  15.    
  16. }
  17. int main() {
  18.    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  19.  
  20. int n; cin>>n;
  21. int arr1[n];
  22. for(int i =0 ; i<n ; i++){
  23.     cin>>arr1[i];
  24. }
  25. palindrome(arr1,n);
  26. if (palindrome (arr1 ,n )) cout<<"yes";
  27. else    cout<<"no";
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement