125182024-12-21 14:39:35KissCsongor777Sorozat generáláscpp17Wrong answer 17/50134ms1052 KiB
#include <bits/stdc++.h>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    int m,x,a,b,n,k,p,q,r;
    cin>>m>>x>>a>>b>>n>>k;
    p=pow(10,4*m-1);q=pow(10,2*m);r=pow(10,m);
    vector<int>h;
    h.push_back(x);
    vector<int>::iterator c;
    bool van=false;
    for(int i=1; i<=n-1; i++)
    {
        x=a*x+b;
        if(x<p)x=p+x;
        x=x/r;
        x=x%q;
        c=find(h.begin(),h.end(),x);
        if(c!=h.end() && !van ){cout<<i-distance(h.begin(),c)<<endl; van=true;}
        h.push_back(x);
    }
    sort(h.begin(),h.end());
    reverse(h.begin(),h.end());
    cout<<h[9];

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base17/50
1Accepted0/01ms500 KiB
2Wrong answer0/0134ms1052 KiB
3Partially correct1/21ms508 KiB
4Accepted2/21ms320 KiB
5Partially correct1/21ms320 KiB
6Partially correct1/21ms320 KiB
7Accepted2/21ms320 KiB
8Partially correct2/42ms320 KiB
9Partially correct2/46ms536 KiB
10Partially correct2/417ms676 KiB
11Partially correct2/412ms712 KiB
12Partially correct2/417ms948 KiB
13Wrong answer0/419ms988 KiB
14Wrong answer0/492ms1004 KiB
15Wrong answer0/494ms948 KiB
16Wrong answer0/4104ms1052 KiB
17Wrong answer0/468ms948 KiB