73192024-01-07 10:57:44Laci3000Oszthatóság 31-gyelcpp17Wrong answer 44/503ms3248 KiB
// 2021 nt masodik.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <string>
#include <vector>

using namespace std;


void oszthato_e_31el() {
    long long bemeneti_szam; cin >> bemeneti_szam;

    vector<long long>lepesek;
    if (bemeneti_szam % 31 == 0) {
        cout << "IGEN" << '\n';
    }
    else {
        cout << "NEM" << '\n';
    }
    
    while (bemeneti_szam > 30){
        string szam = to_string(bemeneti_szam);
       // cerr << bemeneti_szam - (szam[szam.size() - 1] - '0') << '\n';
        bemeneti_szam = (bemeneti_szam - (szam[szam.size() - 1] - '0')) / 10 - 3 * (szam[szam.size() - 1] - '0');
        //cerr << bemeneti_szam << '\n';
        if (bemeneti_szam >= 0) {
            lepesek.push_back(bemeneti_szam);
        }
    }
    for (size_t i = 0; i < lepesek.size(); i++)
    {
        cout << lepesek[i] << " ";
    }
}

int main()
{
    oszthato_e_31el();
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base44/50
1Accepted0/03ms1808 KiB
2Accepted0/03ms2064 KiB
3Accepted3/33ms2304 KiB
4Accepted3/33ms2424 KiB
5Accepted4/42ms2552 KiB
6Accepted4/43ms2512 KiB
7Accepted4/43ms2636 KiB
8Accepted4/43ms2852 KiB
9Accepted4/43ms2932 KiB
10Accepted4/43ms2936 KiB
11Accepted4/43ms2964 KiB
12Wrong answer0/43ms3008 KiB
13Accepted4/43ms3036 KiB
14Accepted4/43ms3136 KiB
15Accepted2/23ms3248 KiB
16Wrong answer0/23ms3240 KiB