34482023-02-28 08:55:31AblablablaSorozat generáláscpp17Wrong answer 0/5032ms5356 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int m, x, a, b, n, k;
    cin >> m >> x >> a >> b >> n >> k;
    vector<int> szamok;
    int elozo = x;
    int legkisebb = INT_MAX;
    for(int i = 0; i < n; i++){
        int kovi = ((elozo * a + b) % 1000) / 10;
        int ind = -1;
        for(int j = 0; j < szamok.size(); j++){
            if(szamok[j] == kovi){
                ind = j;
                break;
            }
        }
        if(ind != -1 && i - ind < legkisebb){
            legkisebb = i - ind;
        }
        szamok.push_back(kovi);
        elozo = kovi;
    }

    for(int i = 0; i < n; i++){
        cout << szamok[i] << " ";
    }
    cout << "\n";
    sort(szamok.begin(), szamok.end());
    for(int i = 0; i < n; i++){
        cout << szamok[i] << " ";
    }
    if(legkisebb == INT_MAX){
        legkisebb = 0;
    }
    cout << "\n" << legkisebb << "\n" /*<< szamok[k]*/;
    int szamlalo = 0;
    for(int i = 0; i < n; i++){
        if(i >= k && szamok[i] != szamok[i - 1]){
            cout << szamok[i];
            break;
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1808 KiB
2Wrong answer0/032ms3140 KiB
3Wrong answer0/23ms2228 KiB
4Wrong answer0/24ms2628 KiB
5Wrong answer0/24ms2832 KiB
6Wrong answer0/24ms2896 KiB
7Wrong answer0/24ms3264 KiB
8Wrong answer0/44ms3220 KiB
9Wrong answer0/48ms3708 KiB
10Wrong answer0/416ms4108 KiB
11Wrong answer0/416ms4196 KiB
12Wrong answer0/420ms4744 KiB
13Wrong answer0/426ms4876 KiB
14Wrong answer0/427ms4916 KiB
15Wrong answer0/428ms4916 KiB
16Wrong answer0/428ms5148 KiB
17Wrong answer0/428ms5356 KiB