Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <map>
- #include <set>
- #include <array>
- #include <stack>
- #include <queue>
- #include <random>
- #include <numeric>
- #include <functional>
- #include <chrono>
- #include <utility>
- #include <iomanip>
- #include <assert.h>
- using namespace std;
- void dbg_out() { cerr << endl; }
- template<typename Head, typename... Tail>
- void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
- #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
- #define rng_init mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
- #define rng_seed(x) mt19937 rng(x)
- #define all(x) (x).begin(), (x).end()
- #define sz(x) (int) (x).size()
- #define int long long
- const int MXN = 1e5 + 5, INF = 1e9 + 5;
- int digit_sum(int x) {
- int sum = x;
- while (x) {
- sum += x % 10;
- x /= 10;
- }
- return sum;
- }
- void solve() {
- int N;
- cin >> N;
- vector<int> ans;
- for (int i = max(0ll, N - 100); i < N; i++) {
- if (digit_sum(i) == N) {
- ans.push_back(i);
- }
- }
- cout << sz(ans) << "\n";
- for (const auto &x : ans)
- cout << x << "\n";
- }
- signed main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- int TC = 1;
- // cin >> TC;
- while (TC--) solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement