13612022-05-23 10:33:06nkdorka1212Oszthatóság 31-gyelcpp11Accepted 50/502ms1976 KiB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define accept_plss ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long

vector<int>sol;
bool pos=false;

void divide(int n)
{
    int m=n%10;
    int num=n/10;
    int r=num-3*m;
    if(r>0)
    {
        sol.push_back(r);
        divide(r);
    }else if(r==0)
    {
        sol.push_back(r);
        pos=true;
    }
    return;
}

signed main()
{
    accept_plss;
    int n;
    cin>>n;
    divide(n);
    if(pos)
    {
        cout<<"IGEN"<<"\n";
    }else
    {
        cout<<"NEM"<<"\n";
    }
    for(int x:sol)
    {
        cout<<x<<" ";
    }
    cout<<"\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/02ms1816 KiB
2Accepted0/01ms1856 KiB
3Accepted3/31ms1924 KiB
4Accepted3/31ms1924 KiB
5Accepted4/41ms1936 KiB
6Accepted4/41ms1936 KiB
7Accepted4/41ms1944 KiB
8Accepted4/41ms1944 KiB
9Accepted4/41ms1944 KiB
10Accepted4/41ms1948 KiB
11Accepted4/41ms1960 KiB
12Accepted4/41ms1960 KiB
13Accepted4/41ms1960 KiB
14Accepted4/41ms1964 KiB
15Accepted2/21ms1972 KiB
16Accepted2/22ms1976 KiB