34862023-02-28 12:33:09gergoSorozat generáláscsharpWrong answer 0/50382ms29120 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();

            foreach (var item in lista)
            {
                Console.WriteLine(item);
            }

            lista.Sort();

            Console.WriteLine(n2);
            Console.WriteLine(lista[lista.Count-k]);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/037ms22444 KiB
2Time limit exceeded0/0361ms9092 KiB
3Wrong answer0/235ms23544 KiB
4Wrong answer0/263ms24312 KiB
5Wrong answer0/257ms23876 KiB
6Wrong answer0/252ms24184 KiB
7Wrong answer0/278ms25076 KiB
8Wrong answer0/471ms25552 KiB
9Wrong answer0/4148ms26624 KiB
10Wrong answer0/4245ms29012 KiB
11Wrong answer0/4282ms29120 KiB
12Time limit exceeded0/4370ms9992 KiB
13Time limit exceeded0/4367ms11488 KiB
14Time limit exceeded0/4368ms11368 KiB
15Time limit exceeded0/4368ms11964 KiB
16Time limit exceeded0/4382ms12252 KiB
17Time limit exceeded0/4367ms12456 KiB