34912023-02-28 12:42:15CsongiSorozat generáláscsharpWrong answer 25/50215ms33384 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sorozat
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] be = Console.ReadLine().Split();
            int m = int.Parse(be[0]); int kezd = int.Parse(be[1]); int a = int.Parse(be[2]); int b = int.Parse(be[3]); int lepes = int.Parse(be[4]); int k = int.Parse(be[5]);
            //int[] sorozat = new int[lepes];
            List<int> list = new List<int>();
            List<int> vegso = new List<int>();
            for (int i = 0; i < lepes; i++)
            {
                kezd = gener(m, kezd, a, b);
                if (!list.Contains(kezd))
                {
                    list.Add(kezd);
                    //vegso.Add(kezd);
                }
                else
                {
                    //vegso.Add(kezd);
                    break;
                }
                    
            }
            List<int> lista = new List<int>(list);
            
            while (lista[0] != kezd)
            {
                lista.RemoveAt(0);
            }



            Console.WriteLine(lista.Count);


            for (int i = 0; i < lepes; i++)
            {
                kezd = gener(m, kezd, a, b);
                vegso.Add(kezd);
            }


            vegso.Sort(); // növekvő sorba rendezi
            //Console.WriteLine(vegso[vegso.Count - k]);
            Console.WriteLine("1");
            //for (int i = 0; i < vegso.Count; i++)
            //{
            //    Console.WriteLine("//");
            //    Console.WriteLine(vegso[i]);
            //}
            //for (int i = 0; i < sorozat.Length; i++)
            //{
            //    Console.WriteLine(sorozat[i]);
            //}

            //Console.WriteLine(h);
            Console.ReadKey();
        }

        static int gener(int m, int kezd, int a, int b)
        {
            int szamkesz = -1;
            ulong elsosz = (ulong)kezd * (ulong)a + (ulong)b;
            string h = elsosz.ToString();
            h = new string('0', m * 4 - elsosz.ToString().Length) + h;
            //for (int i = 0; kezd.ToString().Length < m * 4 && i < kezd.ToString().Length; i++)
            //{
            //    h = "0" + h;
            //}
            szamkesz = int.Parse(h.Substring(m, m * 2));
            return szamkesz;
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base25/50
1Wrong answer0/032ms20932 KiB
2Wrong answer0/0187ms31556 KiB
3Partially correct1/232ms22112 KiB
4Partially correct1/239ms23512 KiB
5Partially correct1/239ms23708 KiB
6Partially correct1/237ms23432 KiB
7Partially correct1/241ms24260 KiB
8Partially correct2/446ms25636 KiB
9Partially correct2/468ms30272 KiB
10Partially correct2/4115ms31888 KiB
11Partially correct2/4101ms31884 KiB
12Partially correct2/4127ms32828 KiB
13Partially correct2/4173ms32952 KiB
14Partially correct2/4195ms32992 KiB
15Partially correct2/4215ms33384 KiB
16Partially correct2/4201ms33108 KiB
17Partially correct2/4201ms33200 KiB