15892022-11-28 18:45:25kicsiboglarOszthatóság 31-gyelcpp11Accepted 50/503ms3988 KiB
#include <iostream>
#include <vector>

using namespace std;
long long a,i,n;
vector <int> megold;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    if (n==0)
    {
        cout<<"IGEN\n\n";
        return 0;
    }
    a=n;
    while (a>0)
    {
        i=a%10;
        a=a/10;
        a-=i*3;
        if (a>=0) megold.push_back(a);
    }
    if (megold.empty())
    {
        cout<<"NEM\n\n";
        return 0;
    }
    a=megold.size();
    if (megold[a-1]%31==0)
    {
        cout<<"IGEN\n";
        for (auto e:megold) cout<<e<<" ";
    }
    else
    {
        cout<<"NEM\n";
        if (!megold.empty())
        {
             for (auto e:megold) cout<<e<<" ";
        }
        else cout<<"\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/03ms1892 KiB
2Accepted0/02ms2228 KiB
3Accepted3/32ms2124 KiB
4Accepted3/32ms2320 KiB
5Accepted4/42ms2528 KiB
6Accepted4/42ms2756 KiB
7Accepted4/42ms2960 KiB
8Accepted4/42ms3036 KiB
9Accepted4/42ms3036 KiB
10Accepted4/42ms3012 KiB
11Accepted4/42ms3012 KiB
12Accepted4/42ms3144 KiB
13Accepted4/42ms3340 KiB
14Accepted4/42ms3548 KiB
15Accepted2/22ms3776 KiB
16Accepted2/22ms3988 KiB