Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- #include <vector>
- using namespace std;
- int main()
- {
- vector<int> all_palindromes;
- for(int i = 0; i <= 99999; i++) {
- int pom = i;
- vector<int> v;
- while(pom > 0) {
- v.push_back(pom % 10);
- pom /= 10;
- }
- bool is_palindrom = true;
- for(int j = 0; j < v.size() / 2; j++) {
- if(v[j] != v[v.size() - j - 1]) {
- is_palindrom = false;
- break;
- }
- }
- if(is_palindrom == true) {
- all_palindromes.push_back(i);
- }
- }
- for(int i = 0; i < all_palindromes.size(); i++) {
- cout << all_palindromes[i] << " ";
- }
- int S, E;
- cin >> S >> E;
- queue<int> q;
- q.push(S);
- q.push(0);
- return 0;
- }
- // 1331
- // {1, 3, 3, 1}
- // 0 3
- // 4 - 0 - 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement