Rezultati

Up. imeNalogaJezikRezultatČas oddaje
Aquasonic-2018 Sveti gral C++ 100/100OK 10. maj '18 @ 17:37

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 3,020 MiB 0,000 s OK
#2 5/5 3,148 MiB 0,000 s OK
#3 5/5 3,148 MiB 0,004 s OK
#4 5/5 3,215 MiB 0,004 s OK
#5 5/5 3,020 MiB 0,004 s OK
#6 5/5 3,020 MiB 0,004 s OK
#7 5/5 3,215 MiB 0,004 s OK
#8 5/5 3,277 MiB 0,000 s OK
#9 6/6 3,020 MiB 0,004 s OK
#10 6/6 3,215 MiB 0,000 s OK
#11 6/6 3,211 MiB 0,004 s OK
#12 6/6 3,211 MiB 0,000 s OK
#13 6/6 3,215 MiB 0,004 s OK
#14 6/6 3,020 MiB 0,000 s OK
#15 6/6 3,016 MiB 0,000 s OK
#16 6/6 3,277 MiB 0,004 s OK
#17 6/6 3,277 MiB 0,004 s OK
#18 6/6 3,020 MiB 0,004 s OK

Ocenjevani program (main.cpp):
#include <bits/stdc++.h>

#define f first
#define s second
#define mp make_pair
#define pb push_back

#define left(x) ((x) << 1)
#define right(x) ((x) << 1 | 1)
#define mid(x, y) ((x) + (y) >> 1)

using namespace std;

const int maxn = 1 * 1e5 + 17;

int N;
vector<int> v, ans;

/**
void DFS(int n, int d, vector<int> &c)
{
    if (c.size() == N.size()) {
        if (n == 0) {
            int r = 0;
            for (int w : c)
                r *= 10,
                r += w;
            ans.pb(r);
        }
        return;
    }

    int dd = d + 1;

    /**
    for (int i = 0; i < 10; i++)
        if (i * dd <= n) {
            c.pb(i);
            DFS(n - dd * i, d / 10, c);
            c.pop_back();
        } else return;

    int i;

    i = n / dd;

    cout << i << endl;

    if (i * dd <= n) {
        c.pb(i);
        DFS(n - dd * i, d / 10, c);
        c.pop_back();
    }

    i++;

    if (i * dd <= n) {
        c.pb(i);
        DFS(n - dd * i, d / 10, c);
        c.pop_back();
    }
}
**/

bool ok(int x)
{
    int s = x, y = x;

    while (y > 0)
        s += y % 10,
        y /= 10;

    return s == N;
}

int main()
{
    ios_base::sync_with_stdio(false);

    cin >> N;

    int x = N, c = 0;
    while (x > 0) c++, x /= 10;

    c *= 9;

    for (int i = max(0, N - c - 1); i <= N; i++)
        if (ok(i))
            ans.pb(i);

    cout << ans.size() << endl;
    for (int v : ans) cout << v << endl;

    return 0;
}