229312026-01-16 09:12:57eduka78Oszthatóság 31-gyelcpp17Accepted 50/501ms500 KiB
#include <iostream>
#include <vector>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long n;
    if (!(cin >> n)) return 0;

    long long original_n = n;
    vector<long long> intermediate_steps;

    long long current = n;
    while (current > 0) {
        long long last_digit = current % 10;
        long long prefix = current / 10;

        long long next_val = prefix - (3 * last_digit);

        if (next_val >= 0) {
            intermediate_steps.push_back(next_val);
        }

        current = next_val;

        if (current <= 0) break;
    }

    if (original_n % 31 == 0) {
        cout << "IGEN" << endl;
    } else {
        cout << "NEM" << endl;
    }

    for (size_t i = 0; i < intermediate_steps.size(); ++i) {
        cout << intermediate_steps[i] << (i == intermediate_steps.size() - 1 ? "" : " ");
    }
    cout << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/01ms316 KiB
2Accepted0/01ms316 KiB
3Accepted3/31ms316 KiB
4Accepted3/31ms500 KiB
5Accepted4/41ms316 KiB
6Accepted4/41ms500 KiB
7Accepted4/41ms316 KiB
8Accepted4/41ms324 KiB
9Accepted4/41ms316 KiB
10Accepted4/41ms500 KiB
11Accepted4/41ms316 KiB
12Accepted4/41ms372 KiB
13Accepted4/41ms316 KiB
14Accepted4/41ms316 KiB
15Accepted2/21ms316 KiB
16Accepted2/21ms316 KiB