218312026-01-14 09:01:03TakacsAndrasOszthatóság 31-gyelcpp17Runtime error 44/503ms568 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<int> out;
    while (n > 0) {
        string a = to_string(n);
        int x = a.back()-'0';
        a.pop_back();
        n = stoi(a)-3*x;
        out.push_back(n);
    }
    if (n == 0) out.push_back(0);
    if (out.size() == 1) {
        if (n % 31 == 0) cout << "IGEN\n";
        else cout << "NEM\n";
    }
    else {
        cout << (out[out.size()-2] % 31 == 0 ? "IGEN\n" : "NEM\n");
        for (int i = 0; i < out.size()-1; i++) cout << out[i] << ' ';
        cout << '\n';
    }
}
SubtaskSumTestVerdictTimeMemory
base44/50
1Accepted0/02ms500 KiB
2Accepted0/02ms316 KiB
3Accepted3/32ms316 KiB
4Accepted3/31ms568 KiB
5Accepted4/41ms316 KiB
6Accepted4/41ms316 KiB
7Accepted4/41ms364 KiB
8Accepted4/41ms316 KiB
9Accepted4/41ms316 KiB
10Accepted4/41ms316 KiB
11Accepted4/41ms316 KiB
12Runtime error0/43ms316 KiB
13Accepted4/41ms316 KiB
14Accepted4/41ms316 KiB
15Accepted2/21ms316 KiB
16Wrong answer0/21ms380 KiB