77872024-01-11 10:08:04TortelliniJrSorozat generáláscsharpWrong answer 6/50209ms27328 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++)
            {
                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
base6/50
1Accepted0/035ms22272 KiB
2Wrong answer0/0133ms24196 KiB
3Partially correct1/235ms23392 KiB
4Partially correct1/235ms23652 KiB
5Partially correct1/237ms23548 KiB
6Partially correct1/237ms24092 KiB
7Accepted2/239ms24224 KiB
8Wrong answer0/441ms24320 KiB
9Wrong answer0/445ms24540 KiB
10Wrong answer0/479ms25620 KiB
11Wrong answer0/457ms25184 KiB
12Wrong answer0/481ms26560 KiB
13Wrong answer0/4150ms27004 KiB
14Wrong answer0/4114ms27284 KiB
15Wrong answer0/4112ms27232 KiB
16Wrong answer0/4209ms27328 KiB
17Wrong answer0/4168ms27216 KiB