fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8.  
  9. long long N;
  10. cin >> N;
  11.  
  12. long long ban_dau = N;
  13. long long dao_nguoc = 0;
  14.  
  15. while (N > 0) {
  16.  
  17. long long chu_so_cuoi = N % 10;
  18. long long dao_nguoc = dao_nguoc * 10 + chu_so_cuoi;
  19.  
  20. N = N / 10;
  21. }
  22.  
  23. if (ban_dau == dao_nguoc) {
  24. cout << "YES";
  25. }
  26. else {
  27. cout << "NO";
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5276KB
stdin
123 131
stdout
NO