34642023-02-28 11:19:17BenedekSorozat generáláscsharpWrong answer 28/5081ms27232 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace sorozat_generálás
{
    class Program
    {
        static long general(int m, int a, int b, long x)
        {
            

                long szam = (long)x * (long)a + (long)b;
                szam %= (long)Math.Pow(10, 3 * m);
                szam /= (long)Math.Pow(10, m);
                return szam;
            }
        static void Main(string[] args)
        {
            int[] szam = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int M = szam[0];
            long X = szam[1];
            int A = szam[2];
            int B = szam[3];
            int N = szam[4];
            int K = szam[5];

            long[] szamok = new long[N];
            int ismhossz = 0;

            for (int i = 0; i < N; i++)
            {
                szamok[i] = general(M, A, B, X);
                X = szamok[i];

            }


            Dictionary<long, int> hely = new Dictionary<long, int>();

            for (int i = 0; i < N; i++)
            {
                if (hely.ContainsKey(szamok[i]))
                {
                    ismhossz = i - hely[szamok[i]];
                    break;
                }
                hely.Add(szamok[i], i);

            }
            Console.WriteLine(ismhossz);
            Array.Sort(szamok);
            Console.WriteLine(szamok[K]);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base28/50
1Accepted0/037ms22764 KiB
2Wrong answer0/079ms23640 KiB
3Partially correct1/235ms23176 KiB
4Partially correct1/239ms23616 KiB
5Partially correct1/237ms23752 KiB
6Partially correct1/237ms23924 KiB
7Accepted2/239ms24436 KiB
8Partially correct2/439ms24852 KiB
9Partially correct2/446ms25680 KiB
10Partially correct2/457ms25220 KiB
11Partially correct2/456ms25852 KiB
12Partially correct2/464ms25852 KiB
13Accepted4/472ms26656 KiB
14Partially correct2/475ms26476 KiB
15Partially correct2/475ms26896 KiB
16Partially correct2/479ms27232 KiB
17Partially correct2/481ms26956 KiB