Advertisement
Centipede18

checkMangDoiXung

Apr 1st, 2018
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int check(int a[], int n){
  5.     for(int i = 0; i < n; i++){
  6.         if(a[i] != a[n-i-1]) return 0;
  7.     }
  8.     return 1;
  9. }
  10.  
  11. main(){
  12.     int n, a[100005];
  13.     cin>>n;
  14.     for(int i = 0; i < n; i++) cin>>a[i];
  15.     if(check(a, n)) cout<<"1";
  16.     else cout<<"0";
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement