Advertisement
Josif_tepe

Untitled

Apr 7th, 2021
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     vector<int> all_palindromes;
  9.     for(int i = 0; i <= 99999; i++) {
  10.         int pom = i;
  11.         vector<int> v;
  12.         while(pom > 0) {
  13.             v.push_back(pom % 10);
  14.             pom /= 10;
  15.         }
  16.         bool is_palindrom = true;
  17.         for(int j = 0; j < v.size() / 2; j++) {
  18.             if(v[j] != v[v.size() - j - 1]) {
  19.                 is_palindrom = false;
  20.                 break;
  21.             }
  22.         }
  23.        
  24.         if(is_palindrom == true) {
  25.             all_palindromes.push_back(i);
  26.         }
  27.        
  28.     }
  29.     for(int i = 0; i < all_palindromes.size(); i++) {
  30.         cout << all_palindromes[i] << " ";
  31.     }
  32.     int S, E;
  33.     cin >> S >> E;
  34.     queue<int> q;
  35.     q.push(S);
  36.     q.push(0);
  37.     return 0;
  38. }
  39. // 1331
  40. // {1, 3, 3, 1}
  41. //  0        3
  42.  
  43. // 4 - 0 - 1
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement