Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <sstream>
- #include <cstring>
- #define ll long long
- #define pb push_back
- using namespace std;
- int main() {
- ll n;
- vector <ll> ans;
- cin >> n;
- for (ll i = 0; i <= n; i++) {
- string s;
- stringstream ss , ss1;
- ll b;
- ss << i;
- ss >> s;
- reverse(s.begin() , s.end());
- ss1 << s;
- ss1 >> b;
- if (i + b == n)
- ans.pb(i);
- }
- for (auto i: ans)
- cout << i << " ";
- cout << ans.size();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement