20952022-12-19 09:46:10tamasmarkSorozat generáláscpp17Wrong answer 3/5026ms15964 KiB
// nt generalas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

vector<int>x;
long long n, k, m, i,a,b,kezd,akt,c,z,o,j;
long long y[1000000];

int main()
{
    cin >> m >> kezd >> a >> b >> n >> k;
    /*akt = (kezd * a) + b;
    c = akt;
    while (c != 0)
    {
        z++;
        c = c / 10;
    }
    if (z < 4 * m)
    {
        for(i=1;i<=m;++i)
        {
            akt = akt / 10;
        }
        o = pow(10, 4*m);
        akt = akt % o;
    }
    x.push_back(akt);*/
    akt = kezd;
    for (i = 1; i <= n; ++i)
    {
        akt = (akt * a) + b;
        c = akt;
        z = 0;
        while (c != 0)
        {
            z++;
            c = c / 10;
        }
        if (z < 4 * m)
        {
            for (j = 1; j <= m; ++j)
            {
                akt = akt / 10;
            }
            o = pow(10, 2 * m);
            akt = akt % o;
        }
        else if (z == 4 * m)
        {
            for (j = 1; j <= m; ++j)
            {
                akt = akt / 10;
            }
            o = pow(10, 2 * m);
            akt = akt % o;
        }
        x.push_back(akt);
    }
    for (i = 0; i < x.size(); ++i)
    {
        if (y[x[i]] == 0)
        {
            y[x[i]]++;
        }
        else if (y[x[i]] != 0)
        {
            cout << x[i] << "\n";
            break;
        }
    }
    sort(x.begin(), x.end());
    cout << x[k];
    return 0;
}

// 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
base3/50
1Accepted0/03ms1756 KiB
2Wrong answer0/024ms10108 KiB
3Wrong answer0/22ms1992 KiB
4Wrong answer0/23ms2300 KiB
5Wrong answer0/23ms2508 KiB
6Wrong answer0/22ms2552 KiB
7Partially correct1/23ms2668 KiB
8Wrong answer0/43ms3052 KiB
9Wrong answer0/44ms3264 KiB
10Wrong answer0/48ms3548 KiB
11Wrong answer0/48ms3628 KiB
12Wrong answer0/413ms4268 KiB
13Partially correct2/420ms14436 KiB
14Wrong answer0/421ms14444 KiB
15Wrong answer0/421ms12984 KiB
16Wrong answer0/425ms14788 KiB
17Wrong answer0/426ms15964 KiB