78042024-01-11 10:39:07TortelliniJrJárda-L (40)csharpRuntime error 0/4035ms25520 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sorozatGen
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int m = inp[0];
            int jel = inp[1];
            int a = inp[2];
            int b = inp[3];
            int lepessz = inp[4];
            int k = inp[5];
            List<int> eddig = new List<int>();
            int mego = -1;
            for (int i = 0; i < lepessz; i++)
            {
                if ((int)((jel * a + b) / Math.Pow(10, m) % Math.Pow(10, m + 1)) / Math.Pow(10, m * 4) < 1)
                {

                }
                jel = (int)((jel * a + b) / Math.Pow(10, m) % Math.Pow(10, m + 1));
                if (eddig.Contains(jel) && mego == -1)
                {
                    mego = i - eddig.FindIndex(element => element.Equals(jel));
                }
                else
                {
                    eddig.Add(jel);
                }
            }
            eddig.Sort();
            Console.WriteLine(mego);
            Console.WriteLine(eddig[k - 1]);
            Console.ReadLine();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Runtime error0/035ms21252 KiB
2Runtime error0/032ms21948 KiB
3Runtime error0/232ms22240 KiB
4Runtime error0/234ms22424 KiB
5Runtime error0/232ms22888 KiB
6Runtime error0/234ms23320 KiB
7Runtime error0/234ms23560 KiB
8Runtime error0/334ms23480 KiB
9Runtime error0/334ms24064 KiB
10Runtime error0/334ms24144 KiB
11Runtime error0/335ms23948 KiB
12Runtime error0/332ms24212 KiB
13Runtime error0/334ms24356 KiB
14Runtime error0/334ms24668 KiB
15Runtime error0/332ms25056 KiB
16Runtime error0/332ms25464 KiB
17Runtime error0/334ms25520 KiB