20962022-12-19 10:39:46tamasmarkSorozat generáláscpp17Wrong answer 28/5025ms19464 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;
struct hossz
{
    long long szam, hely;
};
hossz y[1000000];

int main()
{
    cin >> m >> kezd >> a >> b >> n >> k;
    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)
        {
            o = pow(10,m);
            akt = akt / o;
            o = pow(10, 2 * m);
            akt = akt % o;
        }*/
            o = pow(10,m);
            akt = akt / o;
            o = pow(10, 2 * m);
            akt = akt % o;
        x.push_back(akt);
    }
    for (i = 0; i < x.size(); ++i)
    {
        if (y[x[i]].szam == 0)
        {
            y[x[i]].szam++;
            y[x[i]].hely = i;
        }
        else if (y[x[i]].szam != 0)
        {
            cout << i - y[x[i]].hely << "\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
base28/50
1Accepted0/03ms1884 KiB
2Wrong answer0/021ms11184 KiB
3Partially correct1/22ms2368 KiB
4Partially correct1/23ms2508 KiB
5Partially correct1/23ms2708 KiB
6Partially correct1/22ms2632 KiB
7Accepted2/23ms2668 KiB
8Partially correct2/43ms3212 KiB
9Partially correct2/44ms3424 KiB
10Partially correct2/48ms3828 KiB
11Partially correct2/48ms4032 KiB
12Partially correct2/413ms4340 KiB
13Accepted4/420ms16796 KiB
14Partially correct2/421ms16656 KiB
15Partially correct2/420ms14828 KiB
16Partially correct2/425ms17680 KiB
17Partially correct2/425ms19464 KiB