34872023-02-28 12:34:29gergoSorozat generáláscsharpWrong answer 10/50101ms29604 KiB
using System;
using System.Collections.Generic;
using System.Linq;

namespace sorozatgeneralas
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] elsosor = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int m = elsosor[0], x = elsosor[1], a =elsosor[2], b=elsosor[3], n=elsosor[4], k=elsosor[5];

            List<int> lista = new List<int>();

            int[] tomb = new int[n];
            int szam;
            int num=0;

            for (int i = 0; i < n; i++)
            {   
                szam = x * a + b;
                string szam2 = Convert.ToString(szam);

                while (szam2.Length < 4 * m) szam2 = "0" + szam2;

                if (lista.Contains(int.Parse(szam2.Substring(szam2.Length / 2 - 1, 2 * m)))) 
                {
                    num = int.Parse(szam2.Substring(szam2.Length / 2 - 1, 2 * m));
                    break; 
                }
                
                lista.Add(int.Parse(szam2.Substring(szam2.Length / 2-1, 2*m)));
                x = lista[i]; 

            }

            int n2 =lista.Count - lista.IndexOf(num);
            

            for (int i = lista.Count; i < n; i++)
            {
                lista.Add(lista[i-n2]);
            }

            lista.Sort();

            Console.WriteLine(n2);
            Console.WriteLine(lista[lista.Count-k]);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/035ms22396 KiB
2Wrong answer0/070ms25504 KiB
3Accepted2/235ms23200 KiB
4Accepted2/235ms23648 KiB
5Accepted2/237ms24560 KiB
6Accepted2/235ms24492 KiB
7Accepted2/237ms24572 KiB
8Wrong answer0/437ms24772 KiB
9Wrong answer0/441ms25616 KiB
10Wrong answer0/448ms25904 KiB
11Wrong answer0/446ms26148 KiB
12Wrong answer0/457ms27404 KiB
13Wrong answer0/485ms28780 KiB
14Wrong answer0/465ms28068 KiB
15Wrong answer0/4101ms29604 KiB
16Wrong answer0/471ms28700 KiB
17Wrong answer0/465ms28300 KiB