MohamedAbdel3al

Wonderful Number

Aug 21st, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <bits/stdc++.h>
  4. using namespace std ;
  5. typedef long long ll ;
  6.  
  7. void ABDEL3AL () {
  8. ios_base::sync_with_stdio(false) , cin.tie(nullptr) , cout.tie(nullptr) ;
  9. #ifndef ONLINE_JUDGE
  10. freopen("input.txt" , "r" ,stdin) , freopen("output.txt" , "w" , stdout) ;
  11. #endif
  12. }
  13.  
  14. void is_wonderful (string s) {
  15. string t = s ;
  16. reverse(s.begin() , s.end()) ;
  17. if (s[0] == '0') cout << "YES" ;
  18. else if (s[s.size() - 1] % 2 && t == s) cout << "YES" ;
  19. else cout << "NO" ;
  20.  
  21. }
  22.  
  23. int main() {
  24. ABDEL3AL() ;
  25. string s ;
  26. cin >> s ;
  27. is_wonderful (s) ;
  28. return 0;
  29.  
  30. }
  31.  
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment