73512024-01-08 09:29:03szabelrSorozat generáláscpp17Wrong answer 0/507ms5032 KiB
#include <iostream>

using namespace std;

int main()
{
    int m,a,b,n,k,x,db=0,x1,ossz=0,h=0,s;
    cin>>m>>x>>a>>b>>n>>k;
    int tomb[100000] {0};
    int tomb1[100000] {0};
    while(ossz==0)
    {
        for(int i=1; i<=n; i++)
        {
        x=x*a+b;
        x=x/(m*10);
        x=x%(m*100);
        tomb[x]++;
        if(tomb[x]==2)
        {
            ossz=x;
            //cout<<ossz<<endl;
            s=i;
            break;
        }
        }
    }
    for(int i=1; i<=10000; i++)
    {
        x=x*a+b;
        x=x/(m*10);
        x=x%(m*100);
        tomb[x]++;
        h++;
        if(tomb[i]==3){
            cout<<h<<endl;
            break;
        }
    }
    for(int i=1; i<=n; i++)
    {
        x=x*a+b;
        x=x/(m*10);
        x=x%(m*100);
        tomb1[x]++;
        //cout<<x<<endl;
    }
    for(int i=1; i<=10000; i++)
    {

        db=db+tomb1[i];
        if(db>=k){
            cout<<i;
            break;
        }

    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/04ms3552 KiB
2Wrong answer0/07ms3688 KiB
3Wrong answer0/23ms4068 KiB
4Wrong answer0/23ms4152 KiB
5Wrong answer0/23ms4288 KiB
6Wrong answer0/23ms4256 KiB
7Wrong answer0/24ms4456 KiB
8Wrong answer0/44ms4556 KiB
9Wrong answer0/44ms4536 KiB
10Wrong answer0/44ms4676 KiB
11Wrong answer0/44ms4660 KiB
12Wrong answer0/44ms4756 KiB
13Wrong answer0/46ms4792 KiB
14Wrong answer0/46ms5032 KiB
15Wrong answer0/46ms4884 KiB
16Wrong answer0/46ms4892 KiB
17Wrong answer0/46ms5020 KiB